SSH远程采用普通用户登录linux主机报错解决方法

现象描述

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Apr 17 09:00:35 2020 from x.x.x.x
Could not chdir to home directory /home/username: No such file or directory
/usr/bin/xauth:  error in locking authority file /home/username/.Xauthority
$ 

解决方法

Could not chdir to home directory /home/username: No such file or directory
1、使用root或者其他正常用户登录到Linux主机
2、切换到家目录cd /home,使用mkdir username创建新目录并修改属主chown -R username:username username
/usr/bin/xauth:  error in locking authority file /home/username/.Xauthority
1grep username /etc/passwd查看username属性与正常登录的用户进行对比发现username默认登录shell为/bin/sh,其他正常用户为/bin/bash
2、usermod -s /bin/bash username

验证结果

再次使用ssh登录linux出现心仪已久的提示符以及报错提示已消除username@localhost:~$ 
原文地址:https://www.cnblogs.com/Wolf-Dreams/p/12717856.html