I would like to be able to spawn a fully working shell environment from upstart script.

Why does sudo su -l user -c bash fail to load user's environment properly?

$ sudo su -l -m adam -c "bash"
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell

How to launch a fully working bash session, similar to the one user gets in virtual tty or when logging in by ssh?

I use Ubuntu 14.04 64bit

  • Have you tried sudo -u adam -i ? – garethTheRed Nov 6 '14 at 8:19
  • sudo -u adam "command" works! I kind of assumed that under upstart's root sudo would lead to the same error as su. I still understand nothing, but I am grateful it works! Thank you! – Adam Ryczkowski Nov 6 '14 at 8:31

garethTheRed appears to have answered this one in the comments:

sudo -u adam -i

or, per the OP:

sudo -u adam "command"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.