I tried to disable login for a user account but got this error in debain:
useradd: unrecognized option '--disabled-login'
What is the equivalent of this command for useradd? Do I have to pick another shell, if so, which one?
I tried to disable login for a user account but got this error in debain:
useradd: unrecognized option '--disabled-login'
What is the equivalent of this command for useradd? Do I have to pick another shell, if so, which one?
Use nologin as the default shell:
useradd --shell /usr/sbin/nologin [...]
*This path is on rpm based packages, not sure if debian has the same.
adduser should be preferred where possible.
– Graeme
Mar 03 '14 at 14:03
Pay special attention to the use of useradd & adduser and which distro you're on. The implementations are often different across distros. I usually use usermod or passwd instead:
For example, you can just lock the password:
$ sudo passwd -l <username>
To unlock:
$ sudo passwd -u <username>
I'd also direct you to these Q&A's that already cover the various methods for "locking" a user's account.
adduser --disabled-login do?From useradd's man page:
--disabled-login
Do not run passwd to set the password. The user won't be able
to use her account until the password is set.
If the user already exists, consider using usermod. You have more than 1 way to disable login. One is just to not set a password (* or x or anything invalid in /etc/passwd). The other is to set default shell of a user to /bin/false (some distros define /bin/NoShell, /bin/nologin or something).
usermod -s /bin/false -p x <username>
useradd?--diabled-loginis an option foradduser. – Graeme Mar 03 '14 at 13:56