[lug] stderr woes

Stephen Queen svq at peakpeak.com
Thu Feb 24 11:02:35 MST 2005


On my Slackware box, the file /dev/stderr is a link
$ ls -l /dev/stderr
lrwxrwxrwx    1 root     root            4 Mar 19  2004
/dev/stderr -> fd/2

$ ls -l /dev/fd/2
lrwx------    1 username      users          64 Feb 24 10:39
/dev/fd/2 -> /dev/pts/3

$ ls -l /dev/pts/3
crw--w----    1 username      tty      136,   3 Feb 24 10:40
/dev/pts/3

So to have write permissions to /dev/stderr on my box you
would have to be the user username.

Stephen Queen


On Thu, 24 Feb 2005, Ron Wright wrote:

> ~ $ cat tmp.sh
> #!/bin/bash
> echo stderr > /dev/stderr
> echo stdout > /dev/stdout
> echo tty > /dev/tty
> ~ $ ./tmp.sh
> stderr
> stdout
> tty
> ~ $ sudo -u nobody ./tmp.sh
> ./tmp.sh: /dev/stderr: Permission denied
> ./tmp.sh: /dev/stdout: Permission denied
> tty
>
> Ron Wright
>
> On Thu, 24 Feb 2005 09:42:34 -0500, Michael Hirsch <mdhirsch at gmail.com> wrote:
> > On Wed, 23 Feb 2005 22:22:34 -0700, Daniel Webb <lists at danielwebb.us> wrote:
> > > I'm getting the following output sometimes from a script:
> > >
> > > /usr/local/bin/ssh-reverse-tunnel: line 63: /dev/stderr: Permission denied
> > > /usr/local/bin/ssh-reverse-tunnel: line 63: /dev/stderr: Permission denied
> > > /usr/local/bin/ssh-reverse-tunnel: line 63: /dev/stderr: Permission denied
> > > /usr/local/bin/ssh-reverse-tunnel: line 63: /dev/stderr: Permission denied
> > >
> > > Line 63 in the script is (from a function):
> > >
> > > echo "$THIS: $*" >/dev/stderr
> > >
> > > If I try:
> > >
> > > echo "test" >/dev/stderr
> > >
> > > from the command line as the same user that runs the script, it just
> > > prints "test" (to stderr, I assume).
> > >
> > > Is there some obvious thing I'm overlooking here?
> >
> > Strange.  I can't reproduce that with a silly little script.  Can you
> > create a smal script that reproduces the problem and post it?
> >
> > Michael
> > _______________________________________________
> > Web Page:  http://lug.boulder.co.us
> > Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> > Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
> >
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
>



More information about the LUG mailing list