小計一下(Restricted shell)

來源:互聯網
上載者:User

標籤:受限的shell

假如我們需要限制一個Linux使用者只能使用我們指定的命令,那麼可以使用限制的shell。

在正常的命令環境下使用:

測試:# bash -r                     # 進入限制的shell# cd /bash: cd: restricted# exit

具體設定:

# useradd test                # 添加使用者# cd bin# ln -s bash rbash            # 設定軟串連# 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     # 注釋掉原來的PATH路徑    PATH=$HOME/.bin        export PATH# mkdir .bin# ln -s /bin/ls .bin/# ln -s /bin/cat .bin/# ln -s /bin/touch .bin/      # 給使用者指定命令## vim /etc/passwd    test:x:502:502::/home/test:/bin/rbash        # 修改shell為rbash    ## passwd test

到此配置結束,登陸測試:

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M00/5B/91/wKiom1UL03Pyymq3AAHJuVyyfs8844.jpg" title="ahhahah.png" alt="wKiom1UL03Pyymq3AAHJuVyyfs8844.jpg" />


測試效果還是很明顯的。具體的限制的shell有哪些限制,wiki上有詳細的說明:


650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/5B/91/wKiom1UL1AKSpu0HAAFT1lgW_A0248.jpg" title="wiki.png" alt="wKiom1UL1AKSpu0HAAFT1lgW_A0248.jpg" />



點擊串連地址.

本文出自 “Soul” 部落格,請務必保留此出處http://chenpipi.blog.51cto.com/8563610/1622584

小計一下(Restricted shell)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.