ubuntu:term:access_other_user_s_screen_session
Ubuntu - Term - Access other user's screen session
An admin might want to check what another user is running using screen. The best you can see even as root using ps, is just the name of the command, like below:
sudo ps awxuf | grep -i screen root 1135 0.0 0.0 13636 976 pts/1 S+ 13:27 0:00 \_ grep --color=auto -i screen john 4245 0.0 0.0 387364 16668 ? Sl Feb02 0:06 | \_ gnome-screensaver 1001 6762 0.0 0.0 347384 10428 ? Sl Feb02 0:00 \_ gnome-screensaver john 625 0.0 0.0 31320 1568 ? Ss 11:57 0:00 SCREEN -S test
pstree -Gap 625 screen,625 -S test └─bash,626
When you try to access the screen session using other user, this is usually the error:
sudo -u john screen -r 625 Cannot open your terminal '/dev/pts/1' - please check.
This is because, your terminal: /dev/pts/1 is only readable and writable to the owner of the terminal:
ls -lh /dev/pts/1 crw--w---- 1 john tty 136, 1 Feb 12 13:30 /dev/pts/1
To overcome this, simply allow read and write to the terminal, to all users:
This needs to be run from the user who's screen you want to read.
chmod o+rw /dev/pts/1 ls -lh /dev/pts/1 crw--w-rw- 1 john tty 136, 1 Feb 12 13:32 /dev/pts/1
Once that done, you can use sudo to access the screen of the other user:
sudo -u john screen -r 625
ubuntu/term/access_other_user_s_screen_session.txt · Last modified: 2020/07/15 09:30 by 127.0.0.1