美文网首页
Linux创建只读用户脚本

Linux创建只读用户脚本

作者: 野草_疯长 | 来源:发表于2021-06-16 08:49 被阅读0次

vim read_user.sh

#/bin/bash
user=$1
passwd=$2
useradd -s /bin/bash ${user}
echo -e "${passwd}"|passwd --stdin ${user}
mkdir /home/${user}/.bin
chown root. /home/${user}/.bash_profile
chmod 755 /home/${user}/.bash_profile
echo -e "PATH=/home/${user}/.bin\nexport PATH" >> /home/${user}/.bash_profile
su - ${user} -c "source /home/${user}/.bash_profile"
ln -s /usr/bin/wc /home/${user}/.bin/wc
ln -s /usr/bin/cd /home/${user}/.bin/cd
ln -s /usr/bin/tail /home/${user}/.bin/tail
ln -s /bin/more /home/${user}/.bin/more
ln -s /bin/cat /home/${user}/.bin/cat
ln -s /bin/grep /home/${user}/.bin/grep
ln -s /bin/find /home/${user}/.bin/find
ln -s /bin/pwd /home/${user}/.bin/pwd
ln -s /bin/ls /home/${user}/.bin/ls
ln -s /bin/less /home/${user}/.bin/less
ln -s /bin/tar /home/${user}/.bin/tar
ln -s /bin/echo /home/${user}/.bin/echo

sh read_uaer.sh user_name passwd

相关文章

网友评论

      本文标题:Linux创建只读用户脚本

      本文链接:https://www.haomeiwen.com/subject/vnkxyltx.html