遠程普通用戶ssh登錄時,提示/bin/bash: Permission denied,用戶名mas,密碼正確。
首先上個圖,用戶遠程登錄步驟,轉自http://www.tldp.org/LDP/LG/issue52/okopnik.html
' ' ' ' ' ' ' '
------------ ' GIF2ASCII '
| Start | ' conversion by '
------------ ' "fastfingers" '
V ' program '
------------------- ' Copyleft 2000 '
___________| init: fork + exec |_______ ' ' ' ' ' ' ' '
| | "/sbin/getty" | |
| ------------------- |
^ V ^
| ---------------------- |
| | getty: wait for user | |
| ---------------------- |
^ V ^
| ---------------------- |
| | getty: read username,| |
| | exec "/bin/login" | |
| ---------------------- |
^ V ^
| ---------------------- |
| | login: read password | |
| ---------------------- |
^ V ^
| / \ |
| / \ |
------------- / Do \ |
| Login: exit |---<-No- / they \ |
------------- \ match?/ ^
\ / |
\ / |
\ / |
| Yes ^
V |
------------------------ |
| login: exec("/bin/sh") | |
------------------------ ^
V |
---------------------- |
| sh: read and execute | |
| commands | ^
---------------------- |
V |
---------- |
| sh: exit |-----------
----------
1、登陸后要執行shell,我們檢查一下用戶登陸后需要使用的shell
cat /etc/passwd
。。。
mas:x:1000:1000:mas:/home/mas:/bin/bash
確認登陸后shell是bin/bash
2、查看文件夾訪問權限
lrwxrwxrwx. 1 root root 7 7月 28 15:23 bin -> usr/bin
bin具有可執行權限
3、在bin目錄下檢查bash權限
-rwxr-xr-x. 1 cmp cmp 960376 11月 20 2015 bash
權限沒有問題
4、診斷好久,注意到bin是個鏈接,實際文件夾是usr,我們看看usr權限
drwxrw----. 17 cmp cmp 4096 8月 1 20:41 usr
其他人缺少執行權限
chmod 755 /usr
5、重新遠程登陸成功。
