Is there a bug with su, and /dev/std*?

From: J.C. Wren (
Date: Fri Jun 06 2003 - 16:38:33 EST

        I was writing a script that writes to /dev/error, and I'm experiencing odd behavior. This is with a 2.4.18 kernel.

        I login to an account, 'jcw'.

        [jcw@drive jcw]$ echo test_msg >/dev/error
        [jcw@drive jcw]$ su - slimedr
        [slimedr@drive jcw]$ echo test_msg >/dev/error
        bash: /dev/stderr: Permission denied

        As user 'jcw' we see

        [jcw@drive jcw]$ ls -l /dev/stderr
        lrwxrwxrwx 1 root root 17 Mar 11 15:28 /dev/stderr -> ../proc/self/fd/2
        [jcw@drive jcw]$ ls -l /proc/self/fd/2
        lrwx------ 1 jcw jcw 64 Jun 6 17:31 /proc/self/fd/2 -> /dev/pts/5
        As user 'slimedr' we see

        [slimedr@drive slimedr]$ ls -l /dev/stderr
        lrwxrwxrwx 1 root root 17 Mar 11 15:28 /dev/stderr -> ../proc/self/fd/2
        [slimedr@drive slimedr]$ ls -l /proc/self/fd/2
        lrwx------ 1 slimedr slimedr 64 Jun 6 17:34 /proc/self/fd/2 -> /dev/pts/5

        So what gives? Shouldn't the user context change with 'su -' allow me to write to /dev/stderr and /dev/stdout?

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Sat Jun 07 2003 - 22:00:31 EST