summary: question abt. rst0 -rw-r--r-- vs. rst1 crw-rw-rw

From: Martin Meadows <PZXKYS_at_atdva3.atd.gmeds.com>
Date: Tue Sep 11 2001 - 15:20:27 EDT
Thanks to the following folks:

Bertrand:     Bertrand_Hutin@notes.amdahl.com
richard:      rbutler@ibc.rm.cnr.it
mark:         hargrme@wisdom.maf.nasa.gov
mystery guru: Stuart.Little@leotel.co.uk
steve:        steve@ttyl.com

Here's the original question:

>We're having a problem writing to a tape drive as a non-root user.
>I've found that the /dev/rst0 permission scheme is -rw-r--r-- and
>it is crw-rw-rw on /dev/rst1. This is a sunos 4.1.3_u1 v.B system.
>
>1) what is the "c" on /dev/rst1. looks like most of the devices
>   in /dev have this (except for rst0)
>2) if I need the "c" on /def/rst0, how do I get it?
>3) Is it okay to chmod 666 /dev/rst0?
>4) any idea why it has this oddball permission scheme?

Summary: rst0 had been fouled up ... not sure how. 
         I corrected the problem by removing it & 
         running /dev/MAKEDEV st0

And here are the responses:

-----------------------------------------------------------------------------

The minor number cannot be selected randomly! try one less than rst1 for a
start, otherwise try MAKEDEV... I've forgotten all the old Solaris commands
like this, but they will surely do no harm. Delete rmt0 before you start


>
>The c means it is a character device. To create one, you'll need to use
>mknod. If you ls -l rst1, you'll find that instead of a file size, you've
>got the major and minor device numbers. At a guess, use the same major, and
>minor -1 for rst0 that you find on rst1 ( after you've deleted rst0
first ).
>
>Once you've successfully created rst0 ( if, of course, you do have 2 tape
>drives ), then you can change the permissions to whatever you want. Using
>the 'oddball' 666 permissions will, of course, allow anyone to overwrite
>your tape!
>
>man ls and mknod will give you some basic info.
>

-----------------------------------------------------------------------------

rst0 was probably created as a file when someone tried to do a tar to a device
that didn't exist. The 'c' implies that the device is a character device, as 
opposed to a block device (b prefix) or ordinary file. Assuming you have a 
tape device available check the kernel configuration file in 
/usr/sys/<machine-arch>/conf
to ensure support is in kernel for st0, delete/move the existing /dev/rst0
and run './MAKEDEV st0'  in /dev.

-----------------------------------------------------------------------------

It means it's a character special device and it should be there for rst0
also. Do you mean that root can write to the tape? It looks to me as
though /dev/rst0 has somehow been changed into a file by mistake - root
would be able to write to the file, but not to the actual tape drive!

> 2) if I need the "c" on /def/rst0, how do I get it?

Easiest way is with mknod - but you need to know the major and minor
block numbers for the device. You can maybe figure them out from rst1,
rst2 etc and also nrst0, nrst1 the corresponding no-rewind devices. On
my system 4.1.1 these are:

rst0   18   0                nrst0    18   4
rst1   18   1                nrst1    18   5
rst2   18   2                nrst2    18   6
...
so the command would be:   (in /dev)    mknod  rst0  c  18  0
(and maybe also for nrst0)

> 3) Is it okay to chmod 666 /dev/rst0?

Yes (AFAIK), but if rst0 is a file you are just giving them permission
to write to it. Create with mknod and then chmod to 666.

>
> 4) any idea why it has this oddball permission scheme?
>

/dev/rst0 is either a file or a symbolic link.

Do:  ls -l "/dev/rst0"  and see what you get.

I appears that /dev/rst0 got overwritten and is now a tar file.
I should have the "c" as part of the permissions if it's not
a symbolic link.

If it is a file, do the following:

You can remove /dev/rst0 and do the following to recreate it:

cd /dev
MAKEDEV

-----------------------------------------------------------------------------

c means character device , correct for a tape drive.
/dev/rst0 is a file, not a tape!
in /dev there all entries should be c or b devices, not files.

The c means it is a character device. To create one, you'll need to use
mknod. If you ls -l rst1, you'll find that instead of a file size, you've
got the major and minor device numbers. At a guess, use the same major, and
minor -1 for rst0 that you find on rst1 ( after you've deleted rst0 first ).

Once you've successfully created rst0 ( if, of course, you do have 2 tape
drives ), then you can change the permissions to whatever you want. Using
the 'oddball' 666 permissions will, of course, allow anyone to overwrite
your tape!

man ls and mknod will give you some basic info.

-----------------------------------------------------------------------------
(response to my question about using mknod command vs. makedev)
The Makedev script will only do the same thing.  So, you should
be ok now.  Is this a new tape device that you've just installed?
-----------------------------------------------------------------------------

_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Tue Sep 11 14:18:24 2001

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:25 EST