Please support VectorLinux!

Author Topic: permissions for scsi tapes  (Read 1973 times)

frayja2002

  • Member
  • *
  • Posts: 16
permissions for scsi tapes
« on: May 04, 2010, 06:03:05 am »
Hi all

How can I give the tape group write access to the tape drives on my system?

I have been trying to use the QIC drive under VL6 light but am getting permission denied errors when trying to use mt (or any command)

If I use sudo everything works ok, but I do not want to do this. I have added myself to the tape group but it does not have permission ?!?

Looking at the permissions of the tape st0 under dev it says

crw-rw---- root root

How can I change this permanently so it is root:tape

Thanks
Alex

Andy Price

  • Packager
  • Vectorite
  • ****
  • Posts: 237
Re: permissions for scsi tapes
« Reply #1 on: May 04, 2010, 07:20:30 am »
Try the change group command e.g chgrp tape /dev/st0 and you should end up with tape as the group if it behaves as a normal file.
Andy

frayja2002

  • Member
  • *
  • Posts: 16
Re: permissions for scsi tapes
« Reply #2 on: May 04, 2010, 07:45:43 am »
you can do this but as soon as you reboot the permissions return to root:root

Alex

rbistolfi

  • Packager
  • Vectorian
  • ****
  • Posts: 2299
Re: permissions for scsi tapes
« Reply #3 on: May 04, 2010, 11:02:57 am »
Maybe creating an udev rule, like:

Code: [Select]
KERNEL=="st*", BUS=="scsi", SYMLINK+="tape", OWNER="root", GROUP="tape", MODE="0664"
More on udev: http://reactivated.net/writing_udev_rules.html

HTH

EDIT: maybe you should add something to match against the device serial id.
« Last Edit: May 04, 2010, 11:05:12 am by rbistolfi »
"There is a concept which corrupts and upsets all others. I refer not to Evil, whose limited realm is that of ethics; I refer to the infinite."
Jorge Luis Borges, Avatars of the Tortoise.

--
Jumalauta!!

Andy Price

  • Packager
  • Vectorite
  • ****
  • Posts: 237
Re: permissions for scsi tapes
« Reply #4 on: May 04, 2010, 09:59:04 pm »
I found an old post on another forum discussing a similar problem to yours which also talked about udev: http://www.linuxforums.org/forum/suse-linux-help/67179-dev-ttys0-permissions-issue.html
Maybe there's already a udev rule if the tape drive is mounting correctly. If there is then you could edit the group and permissions on that.

frayja2002

  • Member
  • *
  • Posts: 16
Re: permissions for scsi tapes
« Reply #5 on: May 04, 2010, 11:50:35 pm »
Thank you Andy Price

I had a look through 50-udev-default.rules and found there was no reference to st or nst (even though the section was labeled as tapes). I added the following lines to the section labeled "# block, tapes, block-releated" and it seems to have done the trick...

KERNEL=="st[0-9]*",         GROUP="tape", MODE="0660"
KERNEL=="nst[0-9]*",         GROUP="tape", MODE="0660"

An "ls" of the dev dir now shows nst0 as being "crw-rw---- root tape"

Thanks for the help
Alex

Andy Price

  • Packager
  • Vectorite
  • ****
  • Posts: 237
Re: permissions for scsi tapes
« Reply #6 on: May 06, 2010, 08:04:59 am »
And thanks to rbistolfi for the link about udev. Interesting reading. The great thing about Linux is that you can edit most config files easily, though understanding what you're doing is not necessarily so easy :)