[Solved] MDM - Auto Login with Screen Lock

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
zetrotrack000

[Solved] MDM - Auto Login with Screen Lock

Post by zetrotrack000 »

Hi

How can I enable autologin in such a way that when my system logs-in, the screen locks automatically (just like we have functionality in KDM)?
PS. I am using Linux Mint 14 MATE Edition.

Regards
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
HeWhoWas

Re: MDM - Auto Login with Screen Lock

Post by HeWhoWas »

Ok, here's my solution to this:

1. Open Screensaver Preferences and ensure "Lock screen when screensaver is active" is checked.
2. Open up your text editor and paste the following into it:

Code: Select all

#!/bin/bash
mate-screensaver-command -a
3. Save the file somewhere safe, where it won't be accidentally deleted.
4. Right click the file you just created, go to Permissions and check the "Execute" box.
5. Open Startup Application Preferences and add an item pointing to the file you just created.
6. Enable auto-login.

This is a bit roundabout, and if someone could supply us with the command to lock the screen directly rather than using the screensaver it would be appreciated.

Edit - This also has the side effect that your screensaver will lock your computer now as well. I would assume that if you're looking to lock on boot then you don't mind this :)

Thanks guys.
zetrotrack000

Re: MDM - Auto Login with Screen Lock

Post by zetrotrack000 »

HeWhoWas!
Thanks a lot for your tip. I will try this today and will tell you the results :)

Regards
zetrotrack000

Re: MDM - Auto Login with Screen Lock

Post by zetrotrack000 »

I have tried your solution but its not working. Here what I did;
1. created a file and put the following;
#!/bin/bash
mate-screensaver-command -a
2. make the file executable
3. put the file in auto start using "Startup Applications"
But the system is not auto locking at startup! The script is correct b/c when I double click on it, it locks the screen.
I have tried a lot but I don't know why its not working!! :(
HeWhoWas

Re: MDM - Auto Login with Screen Lock

Post by HeWhoWas »

My apologies, I wrote this before bed and didn't actually test it. To make it start on boot succesfully you need to change the Startup command to this:

Code: Select all

bash -c "sleep x; y"
Where x is the number of seconds to wait, and y is the location of the file to execute. For example, mine looks like:

Code: Select all

Removed. See below.
Edit - After looking at this for a second, I wonder why I didn't make it easier. Forget the bash script, and just use this command in your startup application:

Code: Select all

bash -c "sleep 5; /usr/bin/mate-screensaver-command -a"
Don't forget to mark the thread solved if this helped!
zetrotrack000

Re: MDM - Auto Login with Screen Lock

Post by zetrotrack000 »

No, its still not working :(

Code: Select all

bash -c "sleep 5; /usr/bin/mate-screensaver-command -a"
The command is working when issued in command prompt but not working when put in Startup Applications.
Kindly check the attached screenshot.
HeWhoWas

Re: MDM - Auto Login with Screen Lock

Post by HeWhoWas »

Try and put it inside a bash script, and then call that as I originally suggested. I have the bash script version running and tested. Here are my details:

Script: /home/ben/scripts/screensaver-start.sh

Script Contents:

Code: Select all

#!/bin/bash
mate-screensaver-command -a
Startup Program Config:

Name: Start Screensaver
Command: bash -c "sleep 5; /home/ben/bin/start-screensaver"

I may have led you astray with using the command directly, that was untested sorry.
zetrotrack000

Re: MDM - Auto Login with Screen Lock

Post by zetrotrack000 »

It just came to my mind that may be your solution is not working on my PC because I have turned off the sleep function of my monitor. Actually when I installed Mint, there was a problem that the monitor sleeps after some time (even after disabling sleep from control panel) and when I press any key to bring the display back, the display comes back but with milkiness in it. So I searched internet and found some command to completely disable that sleep function. Thats may be the reason that your solution is not working. Now I am looking in bash and firefox history that which command I have used but it is not there :(
If I am able to bring back that sleep functionality, then I think your solution will work. Do you have any idea that how can I bring back that sleep functionality?
Regards
HeWhoWas

Re: MDM - Auto Login with Screen Lock

Post by HeWhoWas »

Ah, bugger. Sorry, without knowing how you went about disabling it, it would be difficult to re-enable it.

I've only been using Mint for a few weeks, but if it has some kind of system repair functionality you might want to look into that. Backup your /home/ directory as a precaution beforehand, unless it's on another partition.

Edit - If you can find the instructions you used to do it, I would be able to help.
zetrotrack000

Re: MDM - Auto Login with Screen Lock

Post by zetrotrack000 »

hmm... Thanks for your time and patience :)
zetrotrack000

Re: MDM - Auto Login with Screen Lock

Post by zetrotrack000 »

HeWhoWas wrote:Try and put it inside a bash script, and then call that as I originally suggested. I have the bash script version running and tested. Here are my details:

Script: /home/ben/scripts/screensaver-start.sh

Script Contents:

Code: Select all

#!/bin/bash
mate-screensaver-command -a
Startup Program Config:

Name: Start Screensaver
Command: bash -c "sleep 5; /home/ben/bin/start-screensaver"

I may have led you astray with using the command directly, that was untested sorry.
Now, it worked. Thanks a lot :)
Locked

Return to “MATE”