標籤:
如果需要修改預設的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 的切換