这里未使用rbash新建用户,使用rbash新建只读用户不能使用cd等内置命令。
| 12
 
 | # chown root. /home/test/.bash_profile# chmod 755 /home/test/.bash_profile
 
 | 
- 修改/home/test/.bash_profile配置文件
将PATH改为$HOME/.bin
| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 
 | # .bash_profile
 # Get the aliases and functions
 if [ -f ~/.bashrc ]; then
 . ~/.bashrc
 fi
 
 # User specific environment and startup programs
 
 # PATH=$PATH:$HOME/.local/bin:$HOME/bin
 PATH=$HOME/.bin
 export PATH
 
 | 
- 将允许执行的命令链接到/home/test/.bin目录
| 12
 3
 4
 5
 6
 7
 8
 9
 
 | ln -s /usr/bin/wc /home/test/.bin/wcln -s /usr/bin/tail /home/test/.bin/tail
 ln -s  /usr/bin/more /home/test/.bin/more
 ln -s  /usr/bin/cat /home/test/.bin/cat
 ln -s  /usr/bin/grep /home/test/.bin/grep
 ln -s  /usr/bin/find /home/test/.bin/find
 ln -s  /usr/bin/pwd /home/test/.bin/pwd
 ln -s  /usr/bin/ls /home/test/.bin/ls
 ln -s  /usr/bin/less /home/test/.bin/less
 
 | 
之后使用创建的用户登录系统,用户只拥有只读权限,只能使用软连接的命令。