ssh创建用户

if [ $# -eq 1 ];then
/usr/sbin/userdel $1;
/usr/sbin/groupdel $1;
/usr/sbin/useradd -g users $1;
/usr/bin/passwd -u $1;
/usr/bin/passwd -u -f $1;
mkdir /home/$1
mkdir /home/$1/.ssh;
wget http://ip/pubkey/$1.key -O /home/$1/$1.key
cat /home/$1/$1.key > /home/$1/.ssh/authorized_keys;
chown -R $1 /home/$1;
chgrp -R users /home/$1;
chmod 700 /home/$1;
chmod 700 /home/$1/.ssh;
chmod 600 /home/$1/.ssh/*;
chown -R $1 /home/$1/.ssh;
fi

 

你可能感兴趣的:(ssh,F#)