Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
Wat het doet
vipw and vigr open a copy of the account file in your editor ($VISUAL, $EDITOR or vi) and lock the file, so passwd, useradd and others cannot change it at the same time. When you save, the copy replaces the real file.
After editing /etc/passwd you are asked to edit /etc/shadow too (and after /etc/group also /etc/gshadow), so both stay in sync.
Most work is easier and safer with useradd, usermod and groupmod. Use vipw/vigr for fixes those tools cannot do.
Zo schrijf je het
vipw [OPTION]...
vigr [OPTION]...Opties 6
Meest gebruikt
Niets past bij dit filter.
Voorbeelden 11
$ als gewone gebruiker# als root (of met sudo)
1Edit the user file
vipwOpens /etc/passwd with a lock; afterwards it offers to edit /etc/shadow.
2Edit the group file
vigrOpens /etc/group with a lock.
3Edit the shadow file directly
vipw -sFor example to fix a wrong aging field.
4Edit the group shadow file
vigr -sGroup passwords and group admins.
5Use nano as the editor
EDITOR=nano vipwAny editor works.
6Check the files after a manual edit
pwck -r; grpck -r-r = only report, change nothing.
7Fix a wrong login shell by hand
vipwChange the last field, for example
/bin/bshback to/bin/bash.8Find a second root account (security)
awk -F: '$3 == 0 {print $1}' /etc/passwd rootOnly root may have UID 0. Another name here means a backdoor.
9Find accounts without a password hash (security)
awk -F: '$2 == "" {print $1}' /etc/shadowEmpty field = login without a password. Fix it at once.
10Make a backup before a manual edit
cp -a /etc/passwd /etc/shadow /etc/group /root/The tools also keep a copy: /etc/passwd- and /etc/group-.
11See the lock files during an edit
ls /etc/*.lock/etc/passwd.lock exists while vipw is open.
Niets past bij dit filter.
Let op
- Never edit /etc/passwd or /etc/shadow with a normal editor while the system runs.
- A broken line can stop logins for everybody. Keep a root shell open while you test.
Bestanden
/etc/passwd, /etc/shadow, /etc/group, /etc/gshadow- The files that are edited.
/etc/passwd-, /etc/group-- Backup copies from the last change.
Exitcodes
0 | Done. |
1 | Error (file busy or the editor failed). |