Could not chdir to home directory /home/nomiji: Pe

Could not chdir to home directory /home/nomiji: Permission denied
1.[我们要远程nomiji用户]
[root@shell ~]# ssh [email protected]
[email protected]'s password:
Last login: Mon Aug 13 21:18:55 2018 from shell.com
Could not chdir to home directory /home/nomiji: Permission denied
-bash: /home/nomiji/.bash_profile: Permission denied

2.这种报错是对方的用户的家目录 里的.bash_profile 的拥有者和所属组 的问题
【ls -la 我们可以看到.bash_profile的拥有者和所属组 都是cat 而不是nomiji】
[root@openresty nomiji]# ls -la
total 16
drwx------. 2 cat cat 83 Aug 13 21:17 .
drwxr-xr-x. 4 root root 31 Aug 13 21:18 ..
-rw-------. 1 cat cat 5 Aug 13 21:17 .bash_history
-rw-r--r--. 1 cat cat 18 Apr 10 20:53 .bash_logout
-rw-r--r--. 1 cat cat 193 Apr 10 20:53 .bash_profile
-rw-r--r--. 1 cat cat 231 Apr 10 20:53 .bashrc

3.修改家目录的拥有者和所属组
chown -R nomiji:nomiji /home/nomiji/
此时远程登录就OK了

-bash: /home/nomiji/.bash_logout: Permission denied
Connection to 192.168.122.84 closed.
[root@shell ~]# ssh [email protected]
[email protected]'s password:
Last login: Mon Aug 13 21:20:32 2018 from shell.com
[nomiji@openresty ~]$ whoami
nomiji

猜你喜欢

转载自blog.51cto.com/11685018/2159514