最近开始用JumpServer来管理家里的主机和云服务器,在添加飞牛主机的时候显示连接性错误,但是实际上是可以正常使用ssh的,根据报错信息解决这个显示问题。

报错信息如下:

fatal: [5800-飞牛]: UNREACHABLE! => {"changed": false, "msg": "Failed to create temporary directory. In some cases, you may have been able to authenticate and did not have permissions on the target directory. Consider changing the remote tmp path in ansible.cfg to a path rooted in \"/tmp\", for more error information use -vvv. Failed command was: ( umask 77 && mkdir -p \"` echo /home/xxxx/.ansible/tmp \"&& mkdir \" echo /home/xxxx/.ansible/tmp/ansible-tmp-1738400043.1916904-8824-156235934652817 \" && echo ansible-tmp-1738400043.1916904-8824-156235934652817=\" echo /home/ssy/.ansible/tmp/ansible-tmp-1738400043.1916904-8824-156235934652817 `\" ), exited with result 1", "unreachable": true}

从报错信息中可以看出,是因为ansible 没有权限创建目录导致的,因此我们可以直接在对应的路径下面新建文件夹,并设置好权限:

ssh进入系统:

sudo mkdir /home/xxxx
sudo chmod 777 -R /home/xxxx   

其中xxxx是ssh的用户名。再次测试: