1

I use the pexpect module to login a ssh server and then mkdir a directory:

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:

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

I know there maybe the s.logout() affected it, but how to resolve this problem.

user7693832
  • 6,119
  • 19
  • 63
  • 114

1 Answers1

0

You can use

s.send('mkdir aaa\n')

to avoid the issue.

aircraft
  • 25,146
  • 28
  • 91
  • 166