2

I have already gone through the post in Unix & Linux and tried altering /etc/passwd manually like below

user1:x:1001:1001:,,,:/home/user1:/usr/sbin/nologin

after making change user1 is not being able to login from terminal but surprisingly can login from gnome

What's wrong?

Description:    Ubuntu 14.04.3 LTS
kernel:         3.19.0-33-generic
Neel
  • 373

1 Answers1

2
passwd -l

that might be what you're looking for :)

from the passwd man page:

-l, --lock Lock the password of the named account. This option disables a password by changing it to a value which matches no possible encrypted value (it adds a ´!´ at the beginning of the password).

Note that this does not disable the account. The user may still be able to login using another authentication token (e.g. an SSH key). To disable the account, administrators should use usermod --expiredate 1 (this set the account's expire date to Jan 2, 1970).

Users with a locked password are not allowed to change their password.

CZ0
  • 21