Page 1 of 1

[Solved] MDM - Auto Login with Screen Lock

Posted: Fri Apr 05, 2013 1:27 pm
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

Re: MDM - Auto Login with Screen Lock

Posted: Sun Apr 07, 2013 5:22 am
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.

Re: MDM - Auto Login with Screen Lock

Posted: Sun Apr 07, 2013 8:19 am
by zetrotrack000
HeWhoWas!
Thanks a lot for your tip. I will try this today and will tell you the results :)

Regards

Re: MDM - Auto Login with Screen Lock

Posted: Sun Apr 07, 2013 3:51 pm
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!! :(

Re: MDM - Auto Login with Screen Lock

Posted: Sun Apr 07, 2013 10:35 pm
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!

Re: MDM - Auto Login with Screen Lock

Posted: Mon Apr 08, 2013 5:13 pm
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.

Re: MDM - Auto Login with Screen Lock

Posted: Tue Apr 09, 2013 3:44 am
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.

Re: MDM - Auto Login with Screen Lock

Posted: Tue Apr 09, 2013 12:35 pm
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

Re: MDM - Auto Login with Screen Lock

Posted: Tue Apr 09, 2013 6:02 pm
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.

Re: MDM - Auto Login with Screen Lock

Posted: Wed Apr 10, 2013 5:05 am
by zetrotrack000
hmm... Thanks for your time and patience :)

Re: MDM - Auto Login with Screen Lock

Posted: Wed Jun 25, 2014 4:53 pm
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 :)