Re: Strange behaviour of devfs wrt /dev/tty

Richard Gooch (Richard.Gooch@atnf.CSIRO.AU)
Sun, 26 Apr 1998 16:06:06 +1000


Gerhard Mack writes:
> On Sun, 26 Apr 1998, Richard Gooch wrote:
>
> > Gerhard Mack writes:
> > >
> > > I get this without devfs.
> > >
> > > On Sun, 26 Apr 1998, Richard Gooch wrote:
> > >
> > > > Roderich Schupp writes:
> > > > > I noticed the following strange behaviour with devfs (patch-v27,
> > > > > kernel 2.1.98). If some program opens /dev/tty (e.g. "cat < /dev/tty")
> > > > > /dev/tty suddenly changes owner/group (to the uid/gid of the
> > > > > program opening the device) and permissions (600). The problem is:
> > > > > all other processes on the system see the _same_ permissions
> > > > > of /dev/tty. Shouldn't that be visible only to the processes with
> > > > > the same controlling terminal?
> >
> > So you are getting /dev/tty ownership/permissions changes *without*
> > devfs? That's strange. What are the permissions before and after some
> > random user opens /dev/tty ?
>
> I seriously don't know what is doing this, it's something that has had me
> wondering.
> I am willing to poke around some more if you want, just tell me where to
> look. This is without devfs.
>
> Gerhard
>
> crw-rw---- 1 root root 4, 0 Feb 7 1996 tty0
> crw--w---- 1 gmack tty 4, 1 Apr 25 22:38 tty1
> crw--w---- 1 gmack tty 4, 2 Apr 25 22:38 tty2
> crw--w---- 1 gmack tty 4, 3 Apr 25 22:28 tty3
> crw------- 1 gmack tty 4, 4 Apr 25 22:36 tty4
> crw------- 1 root tty 4, 5 Apr 25 22:38 tty5
> crw--w---- 1 gmack tty 4, 6 Apr 25 21:44 tty6
> crw-rw---- 1 root root 4, 7 Apr 6 16:27 tty7
> crw-rw---- 1 dan dan 4, 8 Dec 31 1979 tty8
> crw-rw---- 1 root tty 4, 9 Nov 10 07:39 tty9

Ah, perhaps you're confused between /dev/tty and /dev/tty? devices?
The /dev/tty device (just that single device) is what was originally
being referred to. That device should have uid/gid = 0/0 and
protection = crw-rw-rw-

The /dev/tty? devices are individual consoles, and programmes like
/bin/login change the ownership to that of the user logged in, and
change it back to uid/gid = 0/0 when the user logs off.

Regards,

Richard....

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu