远程普通用户 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
。。。
mas1000: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、重新远程登陆成功。
https://www.cnblogs.com/iHqq/p/5760693.html
