Re: RFC: /dev/stdin, symlinks & permissions

Andreas Schwab
2008-03-17T23:54:53Z

Michael Tokarev <mjt@tls.msk.ru> writes:

> # ls -l /dev/pts/0
> crw--w---- 1 root tty 136, 0 Mar 18 02:19 /dev/pts/0
>
> So far so good. Now, I change uid to something else, --
> doing su(8) to "mjt". /proc/self changed obviously,
> but stdin &Co is still here, and points to the same
> /dev/pts/0. But *its* permissions/ownership did not
> change! So now I can't, for example,
>
> $ echo x > /dev/stdout
> bash: /dev/stdout: Permission denied
>
> which is quite unexpected - I for one expect /dev/stdout
> to work the way very similar to /dev/tty, to mean "current
> standard output regardless of any permissions etc".

This has nothing to do with /dev/stdout. Your terminal simply does not
allow access by anyone except user root or group tty. You need to open
it up first, or mount /dev/pts with broader permissions (which is a bad
idea however).

Andreas.

--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."