[paramiko] su: must be run from a terminal
Sergio Tocalini Joerg
sergiotocalini at gmail.com
Sun Nov 8 16:11:37 PST 2009
El dom, 08-11-2009 a las 20:47 -0400, Eri Ramos Bastos escribió:
> Hello, List.
>
> I'm trying to run this: http://pastebin.com/me01a0c4
>
> And what I get is:
>
> $ ./test.py
> su: must be run from a terminal
>
> I tried to add the line bellow after the connection is established,
> without luck:
>
> client.invoke_shell(term='xterm', width=80, height=24)
>
> I get no errors, but nothing returns at the stdout as well.
>
> I'm trying to understand how I should be doing it, but since I'm a
> sysadmin (not a programmer) most of the documentation looks like greek
> for me.
>
> Any hints, please?
>
> Regards,
> Eri Ramos Bastos
>
> _______________________________________________
> paramiko mailing list
> paramiko at lag.net
> http://www.lag.net/cgi-bin/mailman/listinfo/paramiko
Hello,
I'm use paramiko with sudo too, with this function (note: this function
i got before i don't remember when, but i modify to work with sudo, and
this really works.):
def execute(self, command):
channel = self._transport.open_session()
channel.exec_command(command)
if command.startswith("sudo"):
channel.send(self.password + "\n")
output = channel.makefile('rb', -1).readlines()
if output:
return output
else:
return channel.makefile_stderr('rb', -1).readlines()
If you have any suggestion or doubt please let me know.
Regards
--
Larry loves Gentoo (Linux)
______________________
< Have you mooed today? >
-----------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
|| --------w |
|| ||
*****************************************
*****************************************
* GNU/Linux user #413468
* blog.sergiotocalini.com.ar
*****************************************
* MiWiki (Misiones Wiki)
* www.miwiki.org.ar
*****************************************
More information about the paramiko
mailing list