term:access_other_user_s_screen_session
Differences
This shows you the differences between two versions of the page.
term:access_other_user_s_screen_session [2017/04/03 15:06] – created peter | term:access_other_user_s_screen_session [2019/12/04 21:51] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Term - Access other user's screen session ====== | ||
- | |||
- | An admin might want to check what another user is running using screen. | ||
- | |||
- | <code bash> | ||
- | sudo ps awxuf | grep -i screen | ||
- | |||
- | root 1135 0.0 0.0 13636 976 pts/1 S+ | ||
- | john | ||
- | 1001 6762 0.0 0.0 347384 10428 ? Sl | ||
- | john 625 0.0 0.0 31320 1568 ? Ss | ||
- | </ | ||
- | |||
- | |||
- | <code bash> | ||
- | pstree -Gap 625 | ||
- | |||
- | screen,625 -S test | ||
- | |||
- | └─bash, | ||
- | </ | ||
- | |||
- | |||
- | When you try to access the screen session using other user, this is usually the error: | ||
- | |||
- | <code bash> | ||
- | sudo -u john screen -r 625 | ||
- | |||
- | Cannot open your terminal '/ | ||
- | </ | ||
- | |||
- | This is because, your terminal: /dev/pts/1 is only readable and writable to the owner of the terminal: | ||
- | |||
- | |||
- | <code bash> | ||
- | 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: | ||
- | |||
- | <WRAP important> | ||
- | This needs to be run from the user who's screen you want to read. | ||
- | </ | ||
- | |||
- | <code bash> | ||
- | 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: | ||
- | |||
- | <code bash> | ||
- | sudo -u john screen -r 625 | ||
- | </ | ||
- | |||
- | |||
term/access_other_user_s_screen_session.1491231992.txt.gz · Last modified: 2020/07/15 09:30 (external edit)