Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm not sure all accounts are disabled on my computer, including samba-guest, and I need to disable all accounts except the one I'm using. How can I disable them all?

share|improve this question
1  
So, you want to prevent all users from logging in (local and remote) except for yourself? Service(s): just Samba? Do you have other services like SSH enabled? –  Lekensteyn Jan 31 '11 at 12:55
    
Thanks for your replay, I disabled SSH and yes i need to prevent all users local and remote except my self –  Achu Jan 31 '11 at 15:02

5 Answers 5

up vote 2 down vote accepted

You should be able to set accounts to use /bin/false to prevent login.

sudo usermod -s /bin/false <account>

So, for user "baduser", use sudo usermod -s /bin/false baduser .

You can also edit the password file directly, using a command like vipw . The resulting line should look something like this:

jgb:x:1003:1003:,,,:/home/jgb:/bin/false

To be even more secure, you can set allowed users in ssh via /etc/ssh/sshd_config . You would add a line like this:

AllowUsers user1 user2 user3
share|improve this answer
    
You should not ever allow root login, without very specific reason to do that. –  Olli Feb 13 '11 at 20:48
    
@olli -- In this case there's no reason for root in the example, so I've changed it. Thanks for pointing that out. –  belacq Feb 13 '11 at 21:35

/etc/nologin ?

share|improve this answer
    
could you be more specific please –  Achu Jan 31 '11 at 15:49
    
"nologin - prevent non-root users from logging into the system". This will not work for regular users. –  Lekensteyn Jan 31 '11 at 16:16
    
Click on the link to see the man: i think you should do both: 1) create /etc/nologin 2) modify SSH just like jgbelacqua said. –  Benoît Feb 1 '11 at 10:27

should it be permanent oder only for a small time period?

you can disable an account by adding an asterisk in front of the passwords in /etc/password and /etc/shadow or simply backup and delete (same for /etc/samba/smbpasswd depending on your samba config, otherwise you could try to only map your username to the samba an leave the others

share|improve this answer

You could try editing the PAM configuration files.

e.g. add this to the top of your /etc/pam.d/common-auth:

auth [default=1 success=ignore] pam_succeed_if.so quiet uid ne 0
auth pam_succeed_if.so quiet user != youruser

I haven't tested this, so please check it and test it first.

But it's probably easier to just make sure only you (and probably root) belong to the wheel group, then add this to /etc/pam.d/common-auth:

auth     required       pam_wheel.so
share|improve this answer
sudo passwd -l USERNAME

locked

sudo passwd -u USERNAME

unlocked

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.