LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   I want to lock myself out of my system for a set period of time (https://www.linuxquestions.org/questions/linux-general-1/i-want-to-lock-myself-out-of-my-system-for-a-set-period-of-time-664222/)

jagavskyrproblem 08-20-2008 11:26 PM

I want to lock myself out of my system for a set period of time
 
I want to be able to fairly easily lock myself out of my system for a set period of time.

I've been googling a lot, without success, so now I'm turning to you folks for help.

Thanks.

kenneho 08-21-2008 02:17 AM

What's the reason for you wanting this, if I may ask?

If you have physical access to the computer it is fairly easy to break into. So I guess the easiest solution would be to lock the computer in a room and have someone else watch the key. :)

jagavskyrproblem 08-21-2008 07:25 AM

Quote:

Originally Posted by kenneho (Post 3254530)
What's the reason for you wanting this, if I may ask?

Lack of self control. As long as I have a computer nearby, I can't get much done. :)

I need my computer to be running, but inaccessible to myself.

theYinYeti 08-21-2008 08:04 AM

The easiest solution that comes to mind, provided you're not the kind to go and crack your own box, is to create a script that will lock your user (passwd -l user) and schedule a job for unlocking it (passwd -u user).

Yves.

ErV 08-21-2008 09:23 AM

Quote:

Originally Posted by jagavskyrproblem (Post 3254422)
I want to be able to fairly easily lock myself out of my system for a set period of time.

I've been googling a lot, without success, so now I'm turning to you folks for help.

Thanks.

If you know how system works, then locking yourself out of the system is problematic if you have root account, because in this case you'll always find a way to disable your own lockout mechanism, no matter what it is it. There are a lot of possibilities (like calling poweroff with cron every 10 seconds during the period you don't want to access computer), but all this can be avoided by you if you have physical access to the computer, and if you have root account.

To my opinion, the only certain ways to keep you away from computer are following:
1) Give root account to someone else, not you, so this person will create some kind of lockout mechanic to keep you away from computer. This person should have strong intention to keep you away from computer, even you ask to grant you access again.
2) At the time you shouldn't access computer, go to some place without computers (go swimming. visit forest, zoo, join martial/fitness/dancing club, go jogging, walk around the town, or do some workout that'll make you too tired to use your PC.). Again, friend or famimly member might help here. And you can schedule system poweroff with cron at the time you should get up and go.
3) Try to find more interesting and healthly hobby.

jagavskyrproblem 08-21-2008 11:12 AM

Quote:

Originally Posted by theYinYeti (Post 3254833)
The easiest solution that comes to mind, provided you're not the kind to go and crack your own box, is to create a script that will lock your user (passwd -l user) and schedule a job for unlocking it (passwd -u user).

Yves.

Thanks. I tried this.. but the old password still works on xlock and xscreensaver, not when I try to login though (of course.)

Quote:

Originally Posted by ErV
If you know how system works, then locking yourself out of the system is problematic if you have root account, because in this case you'll always find a way to disable your own lockout mechanism, no matter what it is it. There are a lot of possibilities (like calling poweroff with cron every 10 seconds during the period you don't want to access computer), but all this can be avoided by you if you have physical access to the computer, and if you have root account.

I figured that killing sshd, and running something like xlock/xscreensaver that had some sort of time lock would be sufficient. What theYinYeti suggested seemed like a great solution, so I'd like to know what's wrong.

And I'd like to stress again that I want my system to stay running. ;)

arizonagroovejet 08-21-2008 11:51 AM

Sounds to me like by far the best solution to your problem is self control. It's also the easiest to implement.

You will be able to overcome and restriction that you put in place by messing configuration/cronjobs/whatever and by trying to implement such a solution you're just inventing an excuse to use the computer some more. If you're really so lacking in self control that you cannot simply chose not to use the computer at certain times then you need to have someone else control physical access to your computer and possibly seek professional help for your addiction.

If it's a problem of not being able to fill your time with other things then go for a walk at least half an hour a day. It's free, easy and it's good exercise. If you find just walking is too boring, and why wouldn't you, get some sort of mp3 player and find some good podcasts to listen to whilst you walk.

Now stop messing around using your computer to try to work out how to stop yourself using your computer and go do something else!

Just sayin'... ;)

jagavskyrproblem 08-21-2008 12:03 PM

Quote:

Originally Posted by arizonagroovejet (Post 3255075)
Now stop messing around using your computer to try to work out how to stop yourself using your computer and go do something else!

But I'm so close now! I just need a C programmer to modify this program so that it will read the password again when it's time to unlock: http://code.suckless.org/dl/tools/slock-0.9.tar.gz

trickykid 08-21-2008 12:05 PM

If you're in control of locking yourself out, then you have the control to unlock yourself. What your asking isn't really going to stop you if you really want to get on the computer. I'd agree with arizonagroovejet, learn some self-control. If you can't help yourself, find someone who can help you. Get a new hobby, girlfriend/boyfriend, whatever! ;)

ErV 08-21-2008 12:13 PM

Quote:

Originally Posted by jagavskyrproblem (Post 3255021)
I figured that killing sshd, and running something like xlock/xscreensaver that had some sort of time lock would be sufficient. What theYinYeti suggested seemed like a great solution, so I'd like to know what's wrong.

*sigh*. You really want to know how to break your protection from yourself? Here you go. You can always kill X with ctrl+alt+backspace, so you'll be able to log in again. If you can't login again because you are locked out, then you can log in as root via terminal, and unlock yourself. If you can't log in as root (I doubt that), then, because you have access to hardware you can always boot livecd and modify system data by hand. If you can't figure out how to modify configuration, you can reinstall whole system while keeping important data intact. If you can't enter bios (to boot LiveCD) because it's protected by passwords, then you can reset CMOS, remove battery, or find factory password. If you make script which shutdowns computer when you shouldn't be using it (script is run at system startup and every 30 seconds by cron), then you can always log in as root or boot livecd and delete that script.
Or you can wait a day and disable protection at the time you actully can use computer.

To my opinion, trying to lock yourself out of computer where you are root(and have physical access to machine) is hopeless, because there will be always a way to disable that lockout, and in the end you'll be spending more time with computer trying to find that way.

Really, try non-computer solutions I've listed before.

Quote:

Originally Posted by trickykid (Post 3255086)
Get a new hobby, girlfriend/boyfriend, whatever! ;)

One of the best solutions, I think. Seriously.

trickykid 08-21-2008 12:17 PM

Quote:

Originally Posted by ErV (Post 3255094)
To my opinion, trying to lock yourself out of computer where you are root(and have physical access to machine) is hopeless, because there will be always a way to disable that lockout, and in the end you'll be spending more time with computer trying to find that way.

I think of it this way. What the OP is asking is kind of like a drug addict locking his drugs in a cabinet and throwing the keys up on the roof of his house, having a ladder readily available in his garage. :)

anomie 08-21-2008 12:22 PM

Pull the power cord, throw it in the trunk of your car, and park your car two blocks away. The effort of having to retrieve the cord will discourage you from using your computer for trivial purposes during "lockdown" periods.

trickykid 08-21-2008 12:29 PM

Quote:

Originally Posted by anomie (Post 3255099)
Pull the power cord, throw it in the trunk of your car, and park your car two blocks away. The effort of having to retrieve the cord will discourage you from using your computer for trivial purposes during "lockdown" periods.

No, give it to a friend to keep. Two blocks away is not far, two miles isn't that far even. If they really can't keep themselves away from a computer with self control, they should seek help. ;)

ErV 08-21-2008 12:31 PM

Quote:

Originally Posted by trickykid (Post 3255097)
I think of it this way. What the OP is asking is kind of like a drug addict locking his drugs in a cabinet and throwing the keys up on the roof of his house, having a ladder readily available in his garage. :)

The best solution really is to sell computer or to live a month with some distant relatives (preferably living in the farmlands without computers), or to find a girlfriend/hobby. I'd recommend girlfriend.

Another possible solution is to find an extremely boring job where you'll have to use computers a lot solely for the purpose of work. In this case there'll be chance that after a month you'll hate computers and everything associated with them.

jagavskyrproblem 08-21-2008 12:45 PM

Hehe. Lots of amusing replies... But I think I've found a good enough solution. I'll use 'passwd -l' and '-u' with slock, and ssh in from my eee 900 when it's time to unlock (root access via sshd is off). As I've said before, rebooting is not an option, and neither is shutting down, as I have things running. And using the eee for the same purposes as my main computer is not satisfying enough to replace it. :) I hope I've made sense ...


All times are GMT -5. The time now is 03:56 PM.