Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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
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:


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. – belacqua 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] quiet uid ne 0
auth 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
share|improve this answer
sudo passwd -l USERNAME


sudo passwd -u USERNAME


share|improve this answer

Your Answer


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.