linux shell 的切換

來源:互聯網
上載者:User

標籤:

如果需要修改預設的shell(一般是bash shell),以便使用的順手。先查看系統可用的shell種類[[email protected] ~]$ chsh -l/bin/sh/bin/bash/sbin/nologin/bin/tcsh/bin/csh/bin/ksh修改當前的shell[[email protected] ~]$ chsh Changing shell for oracle.Password: New shell [/bin/bash]: /bin/kshShell changed.

(或者 sudo usermod -s /bin/tcsh root)

系統當前可用的shell存在在/etc/shells檔案中。[[email protected] ~]$ cat /etc/shells/bin/sh    //早期unix版本上所使用的shell./bin/bash  //很多linux版本預設的shell,也就是所謂的bash shell。/sbin/nologin //不能使用bash shell或者其他shell來登入系統的。/bin/tcsh  //增強版的csh./bin/csh   //老版本的unix上流行的shell類型,近似c語言。/bin/ksh   //unix上流行的shell類型,向上完全相容了Bourne Unix shell,並吸收了很多csh的特性。cat /etc/shells的結果與chsh -l是一致的。不過建議還是使用bash shell,因為他已經足夠健壯,並且吸收了ksh,csh,sh的有用特性。shell的修改需要登出以後,下次登入系統的時候才有效。這裡我又把ksh該成了bash sh,現在查看預設的登入shell。[[email protected] ~]$ cat /etc/passwd | grep -i oracleoracle:x:501:501::/home/oracle:/bin/bash對於那個/sbin/nologin,查看一下/etc/passwd可以發現存在很多這樣的賬戶,這些賬戶是供系統中的服務使用的,這些賬戶不能登入是對於系統安全的一種保護。比如嘗試使用apache這個賬戶登入系統。[[email protected] ~]# su - apacheThis account is currently not available.可以建立檔案/etc/nologin.txt 來提示不能登入的資訊的原因。[[email protected] ~]# vi /etc/nologin.txt  //寫入下面這段話This is a system account,you don‘t allow login with it![[email protected] ~]# su - apache        This is a system account,you don‘t allow login with it!

linux 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.