Linux服務器添加用戶腳本

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;

/usr/bin/passwd -d $1;

/usr/bin/passwd -uf $1;

mkdir /home/$1

mkdir /home/$1/.ssh;

wget http://10.81.29.10/newkey/$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;

rm -f /home/$1/$1.key;

fi


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章