issue with pexpect

D

Daniel

Hello,
For about week i am experiencing a problem with pexpect that's why i
hope you can help me :).
Following is my code which tries to remove some files from the root dir
and the code works on linux debian and freebsd but with no success on
linux fedora .. any idea why this happen only in fedora ?

#!/usr/bin/env python
from __future__ import print_function
import sys
import pexpect
import time

spa=pexpect.spawn('su root')
spa.expect('.*')
print(spa.after)
spa.sendline('abc')
spa.expect('.*')
print(spa.after)
spa.sendline('rm -rf /root/py/pe*')
spa.expect('.*')
print(spa.after)
spa.close()


this is the output in Fedora linux it looks that the script can't
authenticate as root

python]$ ./sk64.py
Password:


rm -rf /root/py/pe*


i appreciate any help thanks in advance
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top