4

Is it normal, that when I am logged in as root, and the used su user, I can't access that users screen sessions?

In this case, screen complains about it not having permissions on /dev/pts/x.

I assume that it can't control the terminal which was opened as root in the way it needs: am I right?

2
  • Have you tried using 'su - user' ?
    – tripledes
    Commented Aug 6, 2012 at 20:26
  • @tripledes Tried it just now, did not work
    – varesa
    Commented Aug 6, 2012 at 21:14

1 Answer 1

7

In general, you can change the ownership of /dev/pts/x to the user that you su to, as root, before you actually su. That way, the user that you su to will have access to attach the screen to your origin terminal.

# chown someuser /dev/pts/x
# su - someuser
$ screen -dr somescreen

If this is something you want to make more smooth, you could look into how ownership is set on terminal devices, so that you could, say, make them group read/writable, and have a small group where users have access. This can have severe security implications, so do take care if you're exploring that path!

2
  • Ok. That's what I did. I created an "alternative su", which executes chown :mygroup $(tty)and the su $1 I added the users to the group
    – varesa
    Commented Aug 7, 2012 at 12:39
  • 1
    I worry about the security implications of changing the ownership of the device file, so my workaround is to simply run script /dev/null right before I run screen.
    – Mox
    Commented Aug 7, 2012 at 21:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .