1 回答
- 最新
- 投票最多
- 评论最多
1
This can happen if you (the ec2-user) do not have read permisson on /home
.
The following would have been done as root:
[root@ip-172-31-46-162 ~]# cd /home
[root@ip-172-31-46-162 home]# ls -las
total 0
0 drwxr-xr-x. 3 root root 22 May 16 00:31 .
0 dr-xr-xr-x. 18 root root 237 May 1 19:03 ..
0 drwx------. 3 ec2-user ec2-user 74 May 16 00:31 ec2-user
[root@ip-172-31-46-162 home]# chmod o-r .
[root@ip-172-31-46-162 home]# ls -las
total 0
0 drwxr-x--x. 3 root root 22 May 16 00:31 .
0 dr-xr-xr-x. 18 root root 237 May 1 19:03 ..
0 drwx------. 3 ec2-user ec2-user 74 May 16 00:31 ec2-user
[root@ip-172-31-46-162 home]#
Now as ec2-user you can still login but cannot display the contents of the parent directory:
[ec2-user@ip-172-31-46-162 ~]$ pwd
/home/ec2-user
[ec2-user@ip-172-31-46-162 ~]$ ls -las
total 12
0 drwx------. 3 ec2-user ec2-user 74 May 16 00:31 .
0 drwxr-x--x. 3 root root 22 May 16 00:31 ..
4 -rw-r--r--. 1 ec2-user ec2-user 18 Jan 28 22:29 .bash_logout
4 -rw-r--r--. 1 ec2-user ec2-user 141 Jan 28 22:29 .bash_profile
4 -rw-r--r--. 1 ec2-user ec2-user 492 Jan 28 22:29 .bashrc
0 drwx------. 2 ec2-user ec2-user 48 May 16 00:35 .ssh
[ec2-user@ip-172-31-46-162 ~]$ cd ..
[ec2-user@ip-172-31-46-162 home]$ ls -las
ls: cannot open directory '.': Permission denied
[ec2-user@ip-172-31-46-162 home]$
If the above is the same as on your host here, SSH in as ec2-user, sudo su -
to root and chmod o+r /home
, and see if that makes a difference.
(NB you must have execite permssion on /home
in order for you to be able to traverse through it to your home directory, which from the screenshots we can see you're able to do. And if you didn't have this you couldn't authenticate in the first place with your SSH public key in ~/.ssh
).
相关内容
- 已提问 4 个月前
- AWS 官方已更新 3 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 8 个月前
- AWS 官方已更新 2 年前
RWC;
Thank you for responding to my question.
I got the issue figured out, finally. This problem has had me stymied for a few days.
I changed the permissions in the home directory and sub-directories. I changed the permissions to 755. I am now able to connect with FileZilla and Notepad++.
Thanks again.