ref: 1869813c30458cd411900b666d3fe6e351887702
dir: /chnvram/
#!/bin/rc
# in Plan 9 passwords are encrypted via the key in nvram
# if you change nvram key, your users cant login with passwords.
# which is -- very bad.
# but sometimes you've got to change nvram password,
# here is a tool that preserves your users passwords;
# while also changing your nvram.
if(! ~ $1 -y){
echo 'this is a dangrous program;
if you don''t know how to use it, maybe you should avoid using it.' >[1=2]
exit usage
}
auth/keyfs
mkdir -p /tmp/keys
echo copying keys...
for(i in /mnt/keys){
user=`{basename $i}
for(i in /mnt/keys/*){
cat $i/secret > /tmp/keys/$user
}
}
echo running auth/wrkey...
auth/wrkey
for(i in /tmp/keys/*){
user=`{basename $i}
wm/chusr -p `{cat $i} $user
}
echo done