In Linux system’s we could disable or delete passwords of an user account, this way we could disable user login. These option could achievable through many way. We would discuss this with delete user’s password from Linux system

So we would see how to user could not login once applying these changes.

Delete user password

We could delete user password or make it empty, this way user can’t login further on system locally or from remote machine. Below method could use to delete password from Linux system.

Syntax

# password --delete u1

We have below one example for same.

# passwd --delete u1
Removing password for user u1.
passwd: Success

We can also verify password has been deleted or not

# grep u1 /etc/shadow
u1::17495:0:99999:7:::

In this case user can’t login on system locally or remotely. While login it will show below message on screen and on logs.

User try to login from remote
# ssh u1@192.168.122.26
u1@192.168.122.26's password: 
Permission denied, please try again.

Below message displayed on /var/log/secure
Nov 25 15:18:23 localhost sshd[1451]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.122.1  user=u1
Nov 25 15:18:25 localhost sshd[1451]: Failed password for u1 from 192.168.122.1 port 41224 ssh2