/etc/shadow is the file which we look for password information.
/etc/shadow content:
===============
scott:!!:16236:0:99999:7:::
peter:!!:16236:0:99999:7:::
kevin:!!:16236:0:99999:7:::
This is actual content for a default user/new user.
[root@node1 /]# passwd -d scott
Removing password for user scott.
passwd: Success
[root@node1 /]# passwd -d peter
Removing password for user peter.
passwd: Success
[root@node1 /]# passwd -d kevin
Removing password for user kevin.
passwd: Success
scott::16236:0:99999:7:::
peter::16236:0:99999:7:::
kevin::16236:0:99999:7:::
The above is the content after remving the password for the user using the command # passwd -d
[root@node1 /]# cat /etc/shadow | awk -F: '($2==""){print $1}'
scott
peter
kevin
[root@node1 /]#
/etc/shadow content:
===============
scott:!!:16236:0:99999:7:::
peter:!!:16236:0:99999:7:::
kevin:!!:16236:0:99999:7:::
This is actual content for a default user/new user.
[root@node1 /]# passwd -d scott
Removing password for user scott.
passwd: Success
[root@node1 /]# passwd -d peter
Removing password for user peter.
passwd: Success
[root@node1 /]# passwd -d kevin
Removing password for user kevin.
passwd: Success
scott::16236:0:99999:7:::
peter::16236:0:99999:7:::
kevin::16236:0:99999:7:::
The above is the content after remving the password for the user using the command # passwd -d
[root@node1 /]# cat /etc/shadow | awk -F: '($2==""){print $1}'
scott
peter
kevin
[root@node1 /]#
Now the above script will give the list of users with EMPTY PASSWORD.
No comments:
Post a Comment