简体   繁体   English

plumbum:SSH到我的远程服务器

[英]plumbum : SSH to my remote server

Good day, I am using plumbum on anaconda to connect to my remote server A. 美好的一天,我在anaconda上使用铅锤连接到远程服务器A。

I have create a new user linux2 and assigned a publickey to that user. 我创建了一个新用户linux2,并为该用户分配了一个公钥。 then changed the permission on the .ssh and authorizedkeys as 然后将.ssh和authorizedkeys的权限更改为

chmod 700 /home/linux2/.ssh chmod 600 chmod 700 /home/linux2/.ssh chmod 600

/home/linux2/.ssh/authorized_keys /home/linux2/.ssh/authorized_keys

When i try the code : 当我尝试代码时:

from plumbum import SshMachine
rem=SshMachine("000.000.131.110",user="linux2",Password = "password")

I am getting the below error: Please assist 我收到以下错误:请协助

CommandNotFound Traceback (most recent call last) in () 1 # YOUR CODE HERE 2 from plumbum import SshMachine ----> 3 rem=SshMachine("000.000.131.110",user="linux2",password = "password") ()中的CommandNotFound Traceback(最近一次调用是最后一次调用)1#您的代码在这里2从铅导入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 if ssh_command is None: 78 if password is not None: ---> 79 ssh_command = local["sshpass"]["-p", password, "ssh"] 80 else: 81 ssh_command = local["ssh"] C:\\ ProgramData \\ Anaconda3 \\ lib \\ site-packages \\ plumbum \\ machines \\ ssh_machine.py init (自身,主机,用户,端口,密钥文件,ssh_command,scp_command,ssh_opts,scp_opts,密码,编码,connect_timeout,new_session)如果ssh_command为None:78,如果密码不是None:---> 79 ssh_command = local [“ sshpass”] [“-p”,密码,“ ssh”] 80否则:81 ssh_command = local [“ ssh”]

C:\\ProgramData\\Anaconda3\\lib\\site-packages\\plumbum\\machines\\local.py in getitem (self, cmd) 206 else: 207 # search for command --> 208 return LocalCommand(self.which(cmd)) 209 else: 210 raise TypeError("cmd must not be a RemotePath: %r" % (cmd,)) C:\\ ProgramData \\ Anaconda3 \\ lib \\ site-packages \\ plumbum \\ machines \\ local.py in getitem (self,cmd)206否则:207#搜索命令-> 208 return LocalCommand(self.which(cmd))209否则:210提高TypeError(“ cmd一定不能是RemotePath:%r”%(cmd,))

C:\\ProgramData\\Anaconda3\\lib\\site-packages\\plumbum\\machines\\local.py in which(cls, progname) 176 if path: 177 return path --> 178 raise CommandNotFound(progname, list(cls.env.path)) 179 180 def path(self, *parts): C:\\ ProgramData \\ Anaconda3 \\ lib \\ site-packages \\ plumbum \\ machines \\ local.py其中(cls,progname)176 if path:177 return path-> 178 throw CommandNotFound(progname,list(cls.env.path) ))179180 def path(self,* parts):

CommandNotFound: ('sshpass', [, , , , , , , , , , , , , , , , , , , , , , ]) CommandNotFound :(“ sshpass”,[、、、、、、、、、、、、、、、、、、、、、、、、))

Based on your output, you appear to be running this from a Windows machine. 根据您的输出,您似乎正在Windows计算机上运行它。 According to the plumbum docs , you should use PuttyMachine (requires putty to be installed), or ParamikoMachine for remote ssh connections on Windows. 根据plumbum docs ,您应该使用PuttyMachine(需要安装腻子 )或ParamikoMachine在Windows上进行远程ssh连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM