[comp.unix.microport] os-enhancements

ott@guug.UUCP (OTT GmbH) (06/25/89)

Operating-system enhancements
=============================

I have made the following modifications in V/386 Release 3.0e.1 to get
around three minor restrictions.

Root-login on screens other than /dev/console (like /dev/cons1)
---------------------------------------------------------------

This one was made because I was sick of logging-in as a prolo and then
'su' and changing environment and and and.

cp /bin/login /bin/login.old

Do not logout from that screen, in case anything goes wrong you will be
able to re-copy the original login-program.

Find the address of the string 'Not on system console' in /bin/login using
a good hexdump-utility, notice the last 3 digits of the address (e.g. 5e4).

Type 'dis /bin/login | grep 5e4 | grep pushl', keep the statement-address
of something like 'pushl  $0x4015e4' (it should be c41).

Dis-assemble again looking behind that address. The 'pushl' is for the
printf ("Not on system console"). You will see a 'pushl $0xa' (the exit-code),
a 'call 0xSomething' (exit) and a 'popl %ecx'. Replace the exit-call with
five nice nop's (hex 90). I have written a small C-program, that allows me
to change bytes ANYWHERE in ANY file. Be sure to have the correct offset for
the bytes to be changed. If in doubt, dump that file again looking for the
hex-codes of the assembler-call-statement.

Switch to another screen (/dev/cons1) and login as root. The 'Not on
system console' will still appear, but login now works. If you don't like
that string, replace the call to printf by another 5 nop's (haven't tried
that).

Notice that root-login is also possible now from other tty's. If you want
to keep your system (more or less) secure, leave /bin/login unchanged. If
you are the only person working on that machine or if you aren't using
external ttys (like me), change it.

This object-code-manipulation wouldn't be neccessary, if the programmers
had used 'strncmp (name,"/dev/cons",9)' instead of a simple 'strcmp'.


More than 4 screens on the console
----------------------------------

Thinking about Xenix (urrgh), where there are 12 screens, I simply tried
this to see if it works. It works.

Make the device-nodes cons[4-9] and chmod them to 622 so that you have the
following in /dev :

crw--w--w-   1 ott      other      5,  1 May 18 05:29 /dev/cons1
crw--w--w-   1 root     sys        5,  2 May 18 05:02 /dev/cons2
crw--w--w-   1 root     sys        5,  3 May 18 05:09 /dev/cons3
crw--w--w-   1 root     sys        5,  4 May 18 05:08 /dev/cons4
crw--w--w-   1 ott      other      5,  5 May 18 06:15 /dev/cons5
crw--w--w-   1 root     sys        5,  6 May 18 04:49 /dev/cons6
crw--w--w-   1 root     sys        5,  7 May 18 04:49 /dev/cons7
crw--w--w-   1 root     sys        5,  8 May 18 05:47 /dev/cons8
crw--w--w-   1 root     sys        5,  9 May 18 05:41 /dev/cons9
crw--w--w-   3 root     sys        5,  0 May 18 04:55 /dev/console

Add virtcon[4-9] in /etc/gettydefs. Note that virtcon3 must be linked to
virtcon4 (see virtcon2 for example), virtcon9 must be linked to itself (as
virtcon3 was before).

Add c[4-9] in /etc/inittab.

Type 'init q' and look at your processes, you will see 6 new gettys. You
can switch to that screens with Alt-F5 thru Alt-F10.


Missing nodes for 3,5 " floppies
--------------------------------

The device-nodes for the 3,5 " floppies as 'first drive' (what dos-users
call A:) were missing. No problem. Just make the nodes f03[dh]t with the
minor-device-number one less the f13[dh]t nodes, chmod them to 666 to get
the following :

brw-rw-rw-   1 root     sys        1,112 Apr 27 20:45 /dev/dsk/f03dt
brw-rw-rw-   1 root     sys        1, 96 Apr 22 19:21 /dev/dsk/f03ht
brw-rw-rw-   2 root     sys        1,113 Nov  9  1988 /dev/dsk/f13dt
brw-rw-rw-   2 root     sys        1, 97 Nov  9  1988 /dev/dsk/f13ht
crw-rw-rw-   1 root     sys        1,112 Apr 27 20:45 /dev/rdsk/f03dt
crw-rw-rw-   1 root     sys        1, 96 Apr 22 19:03 /dev/rdsk/f03ht
crw-rw-rw-   2 root     sys        1,113 Nov  9  1988 /dev/rdsk/f13dt
crw-rw-rw-   2 root     sys        1, 97 Nov  9  1988 /dev/rdsk/f13ht

You may also want to link the new nodes to /dev/SA and /dev/rSA resp.,
I didn't feel the need to do so.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++