Small count (Restricted shell)

Source: Internet
Author: User

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.