美好的一天,我在 anaconda 上使用铅连接到我的远程服务器 A。
我创建了一个新用户 linux2 并为该用户分配了一个公钥。然后将 .ssh 和 authorizedkeys 的权限更改为
chmod 700 /home/linux2/.ssh chmod 600
/home/linux2/.ssh/authorized_keys
当我尝试代码时:
from plumbum import SshMachine
rem=SshMachine("000.000.131.110",user="linux2",Password = "password")
我收到以下错误:请协助
CommandNotFound Traceback (last last call last) in () 1 # YOUR CODE HERE 2 from plumbum import SshMachine ----> 3 rem=SshMachine("000.000.131.110",user="linux2",password = "password")
C:\ProgramData\Anaconda3\lib\site-packages\plumbum\machines\ssh_machine.py in init (self, host, user, port, keyfile, ssh_command, scp_command, ssh_opts, scp_opts, password, encoding, connect_timeout, new_session) 77如果 ssh_command 为 None: 78 如果密码不是 None: ---> 79 ssh_command = local["sshpass"]["-p", password, "ssh"] 80 else: 81 ssh_command = local["ssh"]
C:\ProgramData\Anaconda3\lib\site-packages\plumbum\machines\local.py in getitem (self, cmd) 206 else: 207 # 搜索命令 --> 208 return LocalCommand(self.which(cmd)) 209 else: 210 raise TypeError("cmd 不能是 RemotePath: %r" % (cmd,))
C:\ProgramData\Anaconda3\lib\site-packages\plumbum\machines\local.py 其中(cls, progname) 176 if path: 177 return path --> 178 raise CommandNotFound(progname, list(cls.env.path )) 179 180 def 路径(self, *parts):
CommandNotFound: ('sshpass', [, , , , , , , , , , , , , , , , , , , , , , ])