mktcb (627B)
1 #!/bin/sh 2 # make tcb file structure from a /etc/shadow file. 3 # Usage: cat /etc/shadow | mktcb 4 # TODO: need to set group "auth" and permissions. 5 # http://docs.altlinux.org/manpages/tcb.5.html 6 7 umask 0077 8 mkdir -p /etc/tcb 9 chmod 755 /etc/tcb 10 while read -r line; do 11 name=$(printf '%s' "$line" | cut -f 1 -s -d ':') 12 if test -z x"$name"; then 13 continue 14 fi 15 hash=$(printf '%s' "$line" | cut -f 2 -d ':') 16 mkdir -p "/etc/tcb/$name" 17 chown "$name:root" "/etc/tcb/$name" 18 chmod 700 "/etc/tcb/$name" 19 printf '%s\n' "$line" > "/etc/tcb/$name/shadow" 20 chown "$name:root" "/etc/tcb/$name/shadow" 21 chmod 600 "/etc/tcb/$name/shadow" 22 done