How To Disable An Account and Delete User Password
If you want to disable a user to login the system, then you can delete the user password or sometimes you need to set passwordless login to some special user account so that you do not need to provide any password to login the sytem directlry. In this post you’ll see how to delete a user password and how to disable the user account?
Linux Delete User Password
You can use “password” command with “-d” or “–delete” option to delete user password in linux, issue the following command:
$sudo passswd --delete <username>
or
$sudo passwd -d <username>
let’s see a example, delete password for user “test”, see below command:
$sudo passwd -d test
or
$sudo passwd --delete test
When you delete user password, the pasword filed will be set to empty so that you can login the sytem without password, so anohter way to delete password is to change the “password” filed manually.
Linux Disable User Account
As a linux administrator, how to disable user account to stop the user login, you can use the “usermod” command with “-s /sbin/nologin” option, then that account is not available to login.issue the following command:
$sudo usermod -s sbin/nologin <username>
Example:
let’s disable the above test user account:
[root@devops ~]# usermod -s /sbin/nologin test [root@devops ~]# su test
This account is currently not available.
done…..