If we need to restrict a Linux user to use only the commands we specify, we can use the restricted shell.
Use in a normal command environment:
Test: # bash-r # Enter the restricted shell# cd/bash:cd:restricted# exit
Specific settings:
# useradd test # Add User # cd bin# ln -s bash rbash # Set Soft Connection # cd /home/test# vim .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # user specific environment and startup programs #PATH = $PATH: $HOME/bin # comment out the original path path path= $HOME/.bin export&nBsp path# mkdir .bin# ln -s /bin/ls .bin/# ln -s /bin/cat .bin/# ln -s /bin/touch .bin/ # assigning commands to users ## vim /etc/passwd test:x:502:502::/home/test:/bin/rbash # Modify Shell to Rbash ## passwd test
To this configuration end, login test:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/5B/91/wKiom1UL03Pyymq3AAHJuVyyfs8844.jpg "title=" Ahhahah.png "alt=" Wkiom1ul03pyymq3aahjuvyyfs8844.jpg "/>
The test effect is still very obvious. What are the limitations of the shell with specific restrictions, with detailed instructions on the wiki:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/5B/91/wKiom1UL1AKSpu0HAAFT1lgW_A0248.jpg "title=" Wiki.png "alt=" Wkiom1ul1akspu0haaft1lgw_a0248.jpg "/>
Click the connection address.
This article is from the "Soul" blog, make sure to keep this source http://chenpipi.blog.51cto.com/8563610/1622584
Small count (Restricted shell)