Saturday, October 1, 2016

Password file commands

Here are the list of commands which can be used on /etc/passwd file. vipw This command is being used to edit /etc/passwd file manually... thumbnail 1 summary
Here are the list of commands which can be used on /etc/passwd file.

vipw
This command is being used to edit /etc/passwd file manually. It is not recommended to edit /etc/passwd file manually. All changes on user accounts should be carried out using commands like usermod. But in some scenario if you want to edit passwd file manually, then use this command. It opens file in vi editor and locks it for other users. So any other admin from any other terminal wont be able to open the file in editor for manual editing. This ensures integrity of file.

pwck 
To check integrity of /etc/passwd file this command can be used. Once executed it checks passwd files and its all fields. It reports any issues observed in the file e.g. if user directory does not exist on server, it will report it.


# /usr/sbin/pwck

[/etc/passwd] sfmdb:*:107:20::/home/sfmdb:/sbin/sh
        Login directory not found

[/etc/passwd] smmsp:*:109:20::/home/smmsp:/sbin/sh
        Login directory not found


pwconv
It generates /etc/shadow file which has user passwords in encrypted format under second field in each user entry. If /etc/shadow file already exist on system then this command will update relevant fields if there were any changes in /etc/passwd file. If your system is trusted (see tsconvert command) then user password database (Trusted Computing Database) is being maintained separately and /etc/shadow doesn't exist on system. In that case, this command will update the TCB accordingly.


# /usr/sbin/pwconv

Updating the tcb to match /etc/passwd, if needed.


pwunconv
It reverse the changes made by pwconv command.

No comments

Post a Comment

Any thoughts?