远程普通用户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、重新远程登陆成功。