This need usually arises, when in a multi user machine, you as an admin wanted to check what is other user is running using screen. The best you can see even as root using ps, is just the name of the command, like below:
michael@vbox:~$ 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 michael@vbox:~$ 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:
michael@vbox:~$ 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:
michael@vbox:~$ 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:
john@vbox:~$ chmod o+rw /dev/pts/1
john@vbox:~$ 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:
michael@vbox:~$ sudo -u john screen -r 625
Hope this help :).
No comments:
Post a Comment