/dev/vsc* permissions (was: Re: Spawn_Console)

Tony Nugent (tonyn@sctnugen.ppp.gu.edu.au)
Sun, 18 Feb 1996 17:01:58 +1000


Andries,

> /dev/vcs* is a device that contains the bytes found in console screen
> memory. However, there are no newline characters there.
>
> [Maybe that was a design mistake, I hesitated while writing this code,

You wrote it? I see... generally a job well done. I don't seem to
suffer so badly with any problems mentioned here. Nor problems with
console.c mentioned in another thread.

However...

> In the general case one needs a tiny screendump utility.

Yes. But is it supposed to exist already?

> For example, "setterm -dump N".

% setterm -h
setterm: Argument error, usage

setterm
[ -term terminal_name ]
[ -reset ]
[ -initialize ]
[ -cursor [on|off] ]
[ -repeat [on|off] ]
[ -appcursorkeys [on|off] ]
[ -linewrap [on|off] ]
[ -default ]
[ -foreground black|blue|green|cyan|red|magenta|yellow|white|default ]
[ -background black|blue|green|cyan|red|magenta|yellow|white|default ]
[ -ulcolor black|grey|blue|green|cyan|red|magenta|yellow|white ]
[ -ulcolor bright blue|green|cyan|red|magenta|yellow|white ]
[ -hbcolor black|grey|blue|green|cyan|red|magenta|yellow|white ]
[ -hbcolor bright blue|green|cyan|red|magenta|yellow|white ]
[ -inversescreen [on|off] ]
[ -bold [on|off] ]
[ -half-bright [on|off] ]
[ -blink [on|off] ]
[ -reverse [on|off] ]
[ -underline [on|off] ]
[ -store ]
[ -clear [all|rest] ]
[ -tabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)
[ -clrtabs [ tab1 tab2 tab3 ... ] ] (tabn = 1-160)
[ -regtabs [1-160] ]
[ -blank [0-60] ]
[ -dump [1-NR_CONSOLES] ]
[ -append [1-NR_CONSOLES] ]
[ -file dumpfilename ]
[ -msg [on|off] ]
[ -msglevel [0-8] ]
% setterm -dump 3
can not ioctl dump

It seems that -dump is there but it doesn't work, or doesn't work in
as expectedQ}. (I can't get setterm to tell me it's version
number, and the man page is very short and sweet).

I own the tty on that console (also the second console if they are
numbered from 0)...

% ls -l `which setterm`
-rwxr-xr-x 1 root bin 10968 Mar 2 1995 /bin/setterm*

tony% cat /dev/cvs3
cat: /dev/vcs2: Permission denied

tony% ls -l /dev/cvs3
crw--w--w- 1 root tty 7, 2 Oct 26 09:22 /dev/vcs3

cat /dev/vcsa3
cat: /dev/vcsa3: Permission denied

tony% ls -l /dev/cvsa3
crw--w--w- 1 root tty 7, 130 Oct 26 09:22 /dev/vcsa3

tony% ls -l /dev/tty3
crw--w--w- 1 tony users 4, 2 Feb 18 14:22 /dev/tty3

tony% ls -l /dev/tty5
crw--w--w- 1 root root 4, 5 Feb 18 10:04 /dev/tty5

tony% sudo cat /dev/cvs3
Password:
[cat of console occurs]

tony% echo "I'M A VIRUS INVADING YOUR SCREEN" > /dev/vcsa5
[... and yes, I can write to it, even if root owns tty4 & 5].

The man page says that these devices should be 644, which allows
anyone full *write* access to any vcs*% device. Is this right?
Annoying (although ?harmless?). But I can't read from cvs% or cvsa%
even if I own the tty. Perhaps the problem for setterm is that it is
not suid (undesirable)?

It's a bit inconvenient having to dump a screen with sudo. There are
security issues to think about here, but surely it's safe to assume
that if I own the tty then I should be allowed read access to the
corresponding vcs* device. Why is anyone allowed to write to any
other such device? Can setterm assumption ownership and allow reading
them?

Did you write setterm? (Just wondering... if so, may I make some
suggestions please? :)

> [Maybe that is what I said in the text you deleted.]

I can't recall this being mentioned.

Cheers
Tony
-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-
T.Nugent@sct.gu.edu.au tonyn@sctnugen.ppp.gu.edu.au
Brisbane Queensland Australia
-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-=*#*=-
I am having FUN... I wonder if it's NET FUN or GROSS FUN?
- Zippy the pinhead