[Twisted-Python] changing password remotely with twisted.conch
jean-marc.pouchoulon at ac-montpellier.fr
jean-marc.pouchoulon at ac-montpellier.fr
Tue Oct 12 05:34:17 MDT 2004
Hi,
Due to specificity of passwd command, I am not sure it's a goof idea to
do that but I try to change the root password on remote machine as I
can do it with pexpect
The program seems to wait for a password's confirmation.
2004/10/12 13:05 CEST [SimpleTransport,client] starting service
ssh-connection
2004/10/12 13:05 CEST [SimpleTransport,client] opening channel 0 with
65536 32768
2004/10/12 13:05 CEST [SimpleTransport,client] sending request for
channel 0, request exec
2004/10/12 13:05 CEST [SimpleTransport,client] got extended data 1 'New
UNIX password: '
2004/10/12 13:05 CEST [SimpleTransport,client] got extended data 1
'Retype new UNIX password: '
here it is an extract of my CatChannel(channel.SSHChannel) class.
CMD = 'passwd'
def channelOpen(self, ignoredData):
self.data = ''
d = self.conn.sendRequest(self, 'exec', common.NS(CMD),
wantReply = 1)
d.addCallback(self._cbRequest)
def _cbRequest(self, ignored):
self.write('myrootpassword')
self.conn.sendEOF(self)
def dataReceived(self, data):
self.write('myrootpassword')
self.conn.sendEOF(self)
Did anyone done it ?
Thanks for you answers. ( and thanks to support my basic english ...)
More information about the Twisted-Python
mailing list