On Fri, Feb 5, 2010 at 4:28 PM, james bardin <jbar...@bu.edu> wrote:
> On Thu, Feb 4, 2010 at 9:30 PM, Wan Li <wanli...@gmail.com> wrote:
>
>>
>> So is there a way to "su root" only one time to make each exec_command take
>> the advantage of root privilege?
>>
>
> Yes. You can use sudo.
> I personally prefer to use a root (or admin+sudo) account which can
> only login with a publickey, that way no passwords are needed.
>
>
> On Fri, Feb 5, 2010 at 2:54 AM, Wan Li <wanli...@gmail.com> wrote:
>> I'm also looking into the demo.py to get some inspirations.
>> The input and output are in different thread, it's OK a command line usage.
>> But how can I know whether the command's output recv() is totally complete?
>> Is there a "eof_received" or "command_output_eof" like state or even a event
>> to check?
>
>
> That's the problem with using an interactive shell; you have to parse
> the output yourself. There's is no eof, just a pipe to the remote
> shell.
>


I have the same situation: there is a need to run commands with sudo.
Right now I solved this by changing /etc/sudoers file to not ask
password for specific user.

One possible solution could be to integrate paramiko with
pexpect/fdexpect module(
http://www.noah.org/wiki/Pexpect#experimental_extensions ).

I didn't try it myself, but it is definitely the direction you can look at.

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/

_______________________________________________
paramiko mailing list
paramiko@lag.net
http://www.lag.net/cgi-bin/mailman/listinfo/paramiko

Reply via email to