User.pm: add no-pty to each key in ssh keys file
[girocco.git] / bin / update-pwd-db
blob25cabe7866f076a7679d58d8cc32ce6cd7f3d9ae
1 #!/bin/sh
3 set -e
5 . @basedir@/shlib.sh
7 # If Config.pm $update_pwd_db is set then this script
8 # will be run whenever the passwd database in the jail
9 # has been changed and needs to be updated.
11 # This script will always be passed one or two arguments:
13 # update-pwd-db file [user]
15 # file - always passed. This is the full path to the
16 # file that is about to become the new etc/passwd
17 # file. It will be renamed into place after this
18 # script returns successfully.
20 # user - optionally passed. If passed then the only
21 # change to file involves the username 'user'.
23 [ -n "$1" -a -r "$1" ] || { echo "update-pwd-db: error: no such passwd file: $1" >&2; exit 2; }
24 cd "$cfg_chroot"
25 user_only=
26 [ -z "$2" ] || user_only="-u $2"
27 trap 'chmod 0664 etc/master.passwd etc/pwd.db etc/spwd.db' EXIT
28 awk -F ':' '{ print $1 ":" $2 ":" $3 ":" $4 "::0:0:" $5 ":" $6 ":" $7 }' < "$1" > etc/master.passwd
29 PW_SCAN_BIG_IDS=1 pwd_mkdb -d etc $user_only etc/master.passwd 2>/dev/null