The best way to edit /etc/passwd, or shadow or group file is to use # vipw command. If you use vi to edit /etc/passwd file and same time any user try to change a password while root editing file, /etc/shadow file might be corrupted. To avoid this problem, put a lock while editing file /etc/passwd or /etc/group, use vipw and vigr command which will edit the files /etc/passwd and /etc/group with use -s option.
The main purpose of locks is to prevent file corruption. Do not use vi to edit password file.
# vipw -s : Edit /etc/passwd file
# vigr -s : Edit /etc/group file
Where,
-s : Secure file editing
The main purpose of locks is to prevent file corruption. Do not use vi to edit password file.
# vipw -s : Edit /etc/passwd file
# vigr -s : Edit /etc/group file
Where,
-s : Secure file editing
Example :-
Login as a root user:
# vipw -s
If on same time,other terminal login as normal user and try to change any of User Account password:
$ passwd
$(current) UNIX password:
$Enter new UNIX password:
$Retype new UNIX password:
$passwd: Authentication token lock busy
As you see it returned with an error "passwd: Authentication token lock busy"
This will help to avoid /etc/shadow file corruption.
1 Comments
ReplyDeleteMany businesses are now exploring different methods to enhance their product designs, and DTF printing has become increasingly popular. When searching for a dtf printing service near me, it's important to find a provider that offers high-quality transfers and reliable service. This technology allows for vibrant and durable prints on various fabrics, making it a favorite among clothing brands. Whether you're a small startup or an established company, utilizing a trusted dtf printing service near me can significantly improve your product offerings.