Found out today that running screen as a different user that I sudo into won't work!
i.e.
ssh bob@server # ssh into server as bob
sudo su "monitor" -
screen # fails: Cannot open your terminal '/dev/pts/0'
I have a script that runs as the "monitor" user. We run it in a screen session in order to see output on the screen. The problem is, we have a number of user who logs in with their own account (i.e. bob, james, susie, etc...) and then they sudo into the "monitor" user. Giving them access to the "monitor" user is out of the question.
sudo su "user" -
. Why not usesudo -u user -s
?sudo su
- I think it's just what people get used to (in my case it's because you don't need to know any sudo flags tosudo su
- I don't think I've ever read the sudo manpage :)