fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fab-user] sudo() problems


From: Don Jackson
Subject: [Fab-user] sudo() problems
Date: Mon, 17 Jan 2011 15:18:45 -0800


Hello,

I am having trouble getting the sudo() function within fabric to work on my Solaris10 servers.

I am running :  Fabric 0.9.3 on Mac OS X.

I can ssh to the remote machine in question, and I can sudo there without a password.

When I do that, sudo can clearly find itself on the PATH:

queue $ sudo which sudo /opt/csw/bin/sudo

Here are some entries in a test fabfile, and some of the resulting output:

def runtest():
    run( 'env; which sudo' )

$ fab runtest -H queue.likestream.net
[queue.likestream.net] Executing task 'runtest'
[queue.likestream.net] run: env; which sudo
[queue.likestream.net] out: /opt/csw/bin/sudo

So, fabric and ssh into the machine as me, and can find sudo executable as me.

def runsudotest():
    run( 'sudo env' )
    run( 'sudo which sudo' )

$ fab runsudotest -H queue.likestream.net
[queue.likestream.net] Executing task 'runsudotest'
[queue.likestream.net] run: sudo env
[queue.likestream.net] run: sudo which sudo
[queue.likestream.net] out: /opt/csw/bin/sudo

So, fabric can ssh into the machine as me, and run sudo, and can find the sudo command as su.

def sudotest():
    sudo( 'env' )

$ fab sudotest -H queue.likestream.net   
[queue.likestream.net] Executing task 'sudotest'
[queue.likestream.net] err: ksh: sudo:  not found

Fatal error: sudo() encountered an error (return code 127) while executing 'env'

Aborting.

Demonstrates that running sudo directly from fabric doesn't work.

Here is my entry in sudoers file on the remote machine:

queue $ sudo tail /etc/opt/csw/sudo/sudoers                                         
dcj      ALL = NOPASSWD: ALL

Of course I am currently working around this right now by doing run(  'sudo ….' ), but it would would sure be nice
to just have sudo() work directly.

What am I doing wrong, and/or what can I do to get more debugging output from fabric so I can further debug/fix this problem?

Thanks!

Don


reply via email to

[Prev in Thread] Current Thread [Next in Thread]