A safe, editor-driven way to modify /etc/passwd and related files without risking corruption. 26.05.2026 | reading time: 2 min When you must change entries in /etc/passwd, do not edit the file directly; use vipw to avoid races and corruption, because vipw locks the file and validates edits before installing them. A concrete edit: before and after ```bash $ grep '^jsmith:' /etc/passwd jsmith:x:1001:1001:John Smith:/home/jsmith:/bin/bash $ sudo vipw # the editor opens; change "John Smith" to "John Q. Smith" and save $ grep '^jsmith:' /etc/passwd jsmith:x:1001:1001:John Q. Smith:/home/jsmith:/bin/bash ``` What vipw actually does vipw creates a locked temporary copy of /etc/passwd, invokes $EDITOR (or VISUAL) so the administrator can edit, performs basic validation and then replaces the real file only when changes look sane; this prevents simultaneous editors and reduces the chance of corrupting account records. Important options and caveats Use "vipw -s" to edit /etc/shadow, and prefer sudo or root when invoking vipw; note that on systems using LDAP or NSS-backed accounts editing /etc/passwd may do nothing useful, and scripting edits should favour usermod or API calls instead of automating vipw edits. Where vipw fits in your toolkit For single, manual corrections vipw is ideal; for bulk or scripted changes prefer tools that modify account databases safely, and always run consistency checks (pwck/pwconv) after unusual operations to catch formatting problems. Learning to use vipw well is a small but important step toward reliable system administration; pursue more hands-on practice and consider structured exam prep to formalize skills. Join Bits & Bytes Academy First class LINUX exam preparation. utilities security setup troubleshooting