screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: su & screen bite each other


From: Erik Osheim
Subject: Re: su & screen bite each other
Date: Thu, 20 Nov 2008 14:41:10 -0500

Hello,

This is actually a pretty common problem; after using "su" you can't run
programs which want to write directly to your terminal. You can try this
yourself:

address@hidden TTY=`tty`
address@hidden echo $TTY
/dev/pts/6
address@hidden echo hello world > $TTY
hello world
address@hidden sudo su -c "echo root succeeds > $TTY" root
root succeeds
address@hidden sudo su -c "echo otheruser fails > $TTY" otheruser
/bin/bash: /dev/pts/4: Permission denied

You can "fix" this by changing the permissions on $TTY so that any user can
write to it. This is not particularly secure so I am not encouraging you to do
it, but the command one would use would be "chmod o+rw $TTY" Thus:

address@hidden sudo su -c "echo root has permission > $TTY" otheruser
/bin/bash: /dev/pts/4: Permission denied
address@hidden chmod o+rw $TTY
address@hidden sudo su -c "echo root has permission > $TTY" otheruser
otheruser fails

Good luck,

-- Erik

On Thu, Nov 20, 2008 at 07:59:28PM +0100, Folkert van Heusden wrote:
> Hi,
> 
> Situation: as root-user I start a quake server in screen under an
> other user. Now when I become that user and do screen -r, I get an
> error:
> 
> mauer:/# /bin/su - quake -c /usr/local/games/Quake/bin/start_qw2
> 
> and the /usr/local/games/Quake/bin/start_qw2 script contains:
> ----------------------------------------------------------------------
> #! /bin/sh
> 
> cd /usr/local/games/Quake/bin
> 
> /usr/bin/screen -d -m -S 'QuakeWorld' ./mvdsv
> ----------------------------------------------------------------------
> 
> Now when I do the following:
> mauer:/# su - quake
> address@hidden:~$ screen -r QuakeWorld
> Cannot open your terminal '/dev/pts/28' - please check.
> address@hidden:~$ ls -l /dev/pts/28
> crw--w---- 1 folkert tty 136, 28 2008-11-20 19:58 /dev/pts/28
> 
> what can it be?
> 
> 
> Folkert van Heusden
> 
> -- 
> MultiTail ?r en flexibel redskap f?r att f?lja logfilar, utf?r av
> commandoer, filtrera, ge f?rg, sammanfoga, o.s.v. f?lja.
> http://www.vanheusden.com/multitail/
> ----------------------------------------------------------------------
> Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
> 
> 
> _______________________________________________
> screen-users mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/screen-users




reply via email to

[Prev in Thread] Current Thread [Next in Thread]