fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] sudo error


From: Jeff Forcier
Subject: Re: [Fab-user] sudo error
Date: Tue, 15 Sep 2009 12:14:20 -0400

No, it's not really your fault -- I'm guessing you're SSHing as root,
though? (If so, and if you don't have extenuating circumstances --
tsk!)

What's happening is that you're connecting as user X, then using sudo
to execute as the 'psql' user. However, because we wrap your command
in a login-enabled bash shell, it tries to load user X's
~/.bash_profile -- so if you're connecting as root, that would explain
the attempt to load up /root/.bash_profile.

Unfortunately, since you're sudoing as the psql user, that user won't
have permissions to read /root/.bash_profile, so you get the error
message.

You should be able to make this go away by either setting env.shell to
"/bin/bash -c" (dropping the "-l") or dropping the shell wrapper
altogether by specifying "shell=False" to your sudo() call. Let me
know if that works for you.


We could have Fabric to do the above automatically when the 'user'
argument is used, since I imagine this would almost always come up
when 'user' is used (it's rare for your connecting user's home
directory to be readable by other users.) I'll make a ticket so this
doesn't get lost in the shuffle.

Best,
Jeff

On Tue, Sep 15, 2009 at 11:50 AM, Aljosa Mohorovic
<address@hidden> wrote:
> i'm using:
> sudo("psql -c \"some psql command\"", user="postgres")
>
> command executes ok but i always get "err: /bin/bash:
> /root/.bash_profile: Permission denied"
>
> is there something i'm doing wrong?
>
> Aljosa Mohorovic
>
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/fab-user
>




reply via email to

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