LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Having Problem re-attaching to an attached "screen", any ideas? (https://www.linuxquestions.org/questions/linux-newbie-8/having-problem-re-attaching-to-an-attached-screen-any-ideas-694453/)

helptonewbie 01-02-2009 06:26 AM

Having Problem re-attaching to an attached "screen", any ideas?
 
Hi All,

When i try to re-attach my screen which is definitely there somewhere, i get a less than helpful error message. Has anyone come across it before, or had similar issue?

Code:

user1@hostname> screen -ls
There is a screen on:
        23127..hostname        (Detached)
1 Socket in /var/run/uscreens/S-user1.

user1@hostname> screen -r
Cannot open your terminal '/dev/pts/0' - please check.
user1@hostname> screen -r 23127..hostname
Cannot open your terminal '/dev/pts/0' - please check.
user1@hostname> screen -r 23127.`tty`.hostname
Must run suid root for multiuser support.
user1@hostname>

I know the problem is because i am sshing to root and then 'su - user1'? The "su" causing the issue here...therefore it can't grab the terminal perhaps because its actually root's terminal? OR something like that. But how might it be possible to do this, attach to a screen of a different user from root. It should be possible to:-
Code:

screen -r user1/
Cannot access /var/run/screens/S-user1: No such file or directory

But you see the problem here is that root seems to keep it sockets in '/var/run/screens/S-root'
where as user1 (perhaps all standard users), keep their socket details in '/var/run/uscreens/S-user1'

So where is the path set that it making 'user' and 'root' screens/sockets be in a different path. Is this something i can set when trying to get the screen back with "screen -r <path_to_socket>"

Running on SUSE Linux Enterprise Server 10

Cheers,
MJ

MensaWater 01-02-2009 07:16 AM

You might want to try changing permission on /dev/pts/0 since the initial complaint is it can't open that device.

Presumably /dev/pts/0 is the pseudo-tty you're current login session is on (you can verify by typing "tty" command).

Also pseudo-ttys are used by X programs typically. While it doesn't seem likely to me perhaps your issue is related to Xauthority.

When you ssh into a system using tunneling (see -x and -X options of ssh) it creates a .Xauthority file in your home directory and sets your DISPLAY variable. When you su to root in a tunneled ssh you lose both the DISPLAY and the permissions to .Xauthority as it is restricted to the user that logged in.

There is a way to make it work though:
Do the ssh.
type echo $DISPLAY and save the value you see.
Use chmod to allow access to $HOME/.Xauthority for the user you initially logged in to other users such as root.
su - to new user
type export DISPLAY=<value you saved>
type export XAUTHORITY=<path to your original $HOME/.Xauthority>.

helptonewbie 01-02-2009 08:53 AM

Hi There,
Thanks for the reply, i've looked at the permissions setting of /dev/pts/0 and chmod to be world accessible just temporarily to see if that did help on this issue, which it un-fortunately didn't so i checked out the .Xauthority file and the DISPLAY variable, the .Xauthority was blank/empty and the DISPLAY variable is un-set.
Code:

# cat .Xauthority
# [[ $DISPLAY ]] && echo 'Var Found'
# echo $DISPLAY

# env | grep DISPLAY
#

Cheers
MJ


All times are GMT -5. The time now is 11:41 PM.