The problem when you su -c "screen -r [screen name/pid]" [user] is that the screen is opening the tty of the user you are logged in as to display it's console. And unless it has permissions on the tty for the user you are logged in as, it can't do that.
So you either have to change permissions on the current users tty, or log in as the user the screen is running under to access the screen. Drek bl4nk wrote: > Why? Can't he just do 'su steam' and then 'screen -r'? > > Crazy Canucks wrote: > >> Well if you do that, then you do need to change the permissions on the >> tty. That is what I do because my server is in my home, I am the sole >> user, ssh can only be accessed from my lan, etc. I use a small script >> to accomplish the task. I call it "steam_console" but obviously you can >> call it whatever you wish. >> >> Mine is slightly different, but yours could look something like this: >> >> #!/bin/bash >> >> while [ -z "$user" ] >> do >> echo "Please enter the user your screen session is running under:" >> read user >> done >> >> echo "Here is a list of screen sessions avalable under that user name." >> su -c "screen -ls" $user >> >> while [ -z "$session_name" ] >> do >> echo "Please enter a screen session name from the above list:" >> read session_name >> done >> >> chmod 666 /dev/pts/* >> >> su -c "screen -r $session_name" $user >> >> chmod 620 /dev/pts/* >> >> exit 0 >> >> This script will change the permissions on the contents of pts to allow >> you to open a tty for the user your server is running under, then put >> the permissions back the way they should be after. Note that this is on >> Debian Etch. I don't know if the contents of the pts folder are >> different on different distros, so you might want to check the contents >> before you run the script and adjust the permisson in the second to last >> line accordingly. >> >> However, if your server is in a public space and others have access to >> it, you might not want to use this script. You would be better off just >> to log in as the user that your screen session runs under and do it that >> way. >> >> Drek >> >> Jonass wrote: >> >> >>> Thank you for your responses. >>> I run effectively srcds with screen. >>> But for me I connect like this: >>> - I log into my user with SSH >>> - I do "su steam" >>> - Then I run the screen >>> And in this case, I can not see the screen with "screen -r" due to a >>> problem with permissions. >>> >>> Jonass >>> >>> Mark - hlds list a écrit : >>> >>> >>> >>>> Glad you posted on that, I re-read his post two or three times trying to >>>> figure out why on earth he was saying to change the permissions like >>>> that. There is no reason whatsoever to do it if all you're wanting to >>>> do is resume your screen session as the user who started it in the first >>>> place... so OP, _don't_ change the perms on pts, you'll be able to >>>> 'screen -r' just fine, believe me. >>>> >>>> >>>> Crazy Canucks wrote: >>>> >>>> >>>> >>>> >>>>> Last time I mentioned something like that, I was told changing the >>>>> permissions on your tty's was a bad idea. If you log in and access your >>>>> console as the same user that you started the screen session under, you >>>>> shouldn't need to do that. >>>>> >>>>> Drek >>>>> >>>>> X-GameServer | Alexander Nurevski wrote: >>>>> >>>>> >>>>> >>>>> >>>>> >>>>>> do you start the server in a screen ? >>>>>> >>>>>> If "yes" do this: >>>>>> >>>>>> as root >>>>>> chmod -R 777 /dev/pts >>>>>> >>>>>> then switch to the user your server is installed under >>>>>> su XXXXXXX >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>> _______________________________________________ >>>> To unsubscribe, edit your list preferences, or view the list archives, >>>> please visit: >>>> http://list.valvesoftware.com/mailman/listinfo/hlds_linux >>>> >>>> >>>> >>>> >>> _______________________________________________ >>> To unsubscribe, edit your list preferences, or view the list archives, >>> please visit: >>> http://list.valvesoftware.com/mailman/listinfo/hlds_linux >>> >>> >>> >> _______________________________________________ >> To unsubscribe, edit your list preferences, or view the list archives, >> please visit: >> http://list.valvesoftware.com/mailman/listinfo/hlds_linux >> >> > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, please > visit: > http://list.valvesoftware.com/mailman/listinfo/hlds_linux > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlds_linux

