简体   繁体   English

pexpect pxssh不创建我的需求目录

[英]The pexpect pxssh do not create my requirement directory

I use the pexpect module to login a ssh server and then mkdir a directory: 我使用pexpect模块登录ssh服务器,然后mkdir目录:

from pexpect import pxssh

s = pxssh.pxssh()

s.login(server='43.24.24.29', username='root', password='my_password')

s.send('mkdir aaa')

s.logout()

it works, but I find, in the server, there created aaaexit directory, there is not aaa directory: 它可以工作,但是我发现在服务器中创建了aaaexit目录,没有aaa目录:

[root@localhost ~]# ls
aaaexit  anaconda-ks.cfg

I know there maybe the s.logout() affected it, but how to resolve this problem. 我知道可能s.logout()影响了它,但是如何解决此问题。

You can use 您可以使用

s.send('mkdir aaa\n')

to avoid the issue. 避免问题。

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

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