#! /bin/bash
+# Current user is copied to the specified machine $1
+
if [ $# != 1 ];then
echo "$0 <hostname>"
exit 1
fi
NFSHOME="jsc-nfs.czech.sun.com"
-HOMEPATH="/home.local/$USER"
+HOMEPATH="/net/$NFSHOME/export/home/$USER"
REALNAME="`perl -e '$_=(getpwnam "'"$USER"'")[6];s/^root for //;print;'`"
+PASSWD="`cat $HOME/.passwd`"
-ssh -t root@"$1" '
- set -ex
- grep "^'$USER':" /etc/passwd && exit 1
- useradd '$USER'
- sed '\''s#^'$USER':.*$#'$USER':x:0:0:root for '"$REALNAME:$HOMEPATH"':/bin/bash#'\'' </etc/passwd >/etc/passwd.'$USER';cat /etc/passwd.'$USER' >/etc/passwd;rm -f /etc/passwd.'$USER'
- echo >>/etc/vfstab '"`echo -e "$NFSHOME:$HOMEPATH"'\t-\t'"$HOMEPATH"'\tnfs\t-\tyes\tintr,bg'`"'
- mkdir -p '"$HOMEPATH"'
- mount '"$HOMEPATH"'
- passwd -r files '$USER'
+# "</dev/null" to prevent "stopped" state
+rsh </dev/null -l root "$1" '
+ useradd -c "root for '"$REALNAME"'" -d "'"$HOMEPATH"'" -g 0 -o -s /bin/bash -u 0 '$USER'
+ echo "begin 644 scr\\nM<W!A=VX@<&%S<W=D(\"UR(&9I;&5S(%5315(*;6%T8VA?;6%X(#\$P,#\`P,\`IE\\nM>'\''!E8W0@+65X86-T(\").97<@4&%S<W=O<F0Z(\"(*<V5N9\"\`M+2\`B4\$%34U=\$\\nM7'\''(B\"F5X<&5C=\"\`M97AA8W0@(EQR\"E)E+65N=&5R(&YE=R!087-S=V]R9#H@\\n@(@IS96YD(\"TM(\")005-35T1<<B(*97AP96-T(&5O9@H\`\\n\`\\nend"|uudecode -p|sed -e '\''s/USER/'$USER'/g'\'' -e '\''s/PASSWD/'"$PASSWD"'/g'\''|/usr/dist/exe/expect -f -
echo done
'
exit