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

From: J.C. Wren (jcwren@jcwren.com)
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
        test_msg
        [jcw@drive jcw]$ su - slimedr
        Password:
        [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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



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