Zach
Zach

Reputation: 189

Fabric and Sudo as Another User

Using Fabric to spin up a server, everything works great, except for my attempt to start postgresql.

sudo("/usr/lib/postgresql/9.1/bin/pg_ctl -D /mnt/ebs/postgresql/data -l /mnt/ebs/logfile start", user='postgres')

It outputs "server starting", but it doesn't actually start. Nothing shows up in the postgresql log.

If I ssh in and execute the same command as user postgres it works. If I ssh in and run the following, it works as well.

 sudo su postgres -c '/usr/lib/postgresql/9.1/bin/pg_ctl -D /mnt/ebs/postgresql/data -l /mnt/ebs/logfile start

What aren't I getting about the way fabric does users? Or the way linux users work?

Upvotes: 4

Views: 3348

Answers (1)

Morgan
Morgan

Reputation: 4131

Here's a section in the docs for your use case. It's related not to the sudo, but to the pty settings of default calls. More info in the FAQ.

Upvotes: 3

Related Questions