Re: sata/ata device permission for user

2013-04-18 Thread Tijl Coosemans
On 2013-04-15 07:49, Beeblebrox wrote:
 EDIT: I had already placed in /etc/devfs.conf this entry some time ago:
 
 # Allow members of group operator to mount cdrom
 own /dev/cd0   root:operator
 perm/dev/cd0   0660
 
 Not allowing mount despite all of these adjustments (being tested with data
 cd and NOT audio cd), which is what I am unable to figure out.

The user also needs access to the corresponding pass device which
is shown by camcontrol devlist. He also needs access to /dev/xpt0
I think.



signature.asc
Description: OpenPGP digital signature


sata/ata device permission for user

2013-04-18 Thread Beeblebrox
 The user also needs access to the corresponding pass device which is shown
by camcontrol devlist. He also needs access to /dev/xpt0 I think. 

HL-DT-ST DVDRAM GSA-4165B DL05   at scbus6 target 0 lun 0 (cd0,pass3)

crw---  1 root  operator  0x48 Apr 18 07:08 pass0
crw---  1 root  operator  0x49 Apr 18 07:08 pass1
crw---  1 root  operator  0x4a Apr 18 07:08 pass2
crw---  1 root  operator  0x4b Apr 18 07:08 pass3
crw---  1 root  operator  0x42 Apr 18 07:08 xpt0

User is member of operator group. However, I agree with your idea because
just now I was working with cdrtools and got this error, but when I ran as
root no error:

% cdda2wav summary --device /dev/cd0
cdda2wav: Permission denied. Open of /dev/xpt0 failed. Cannot open or use
SCSI driver.
cdda2wav: For possible targets try 'cdda2wav -scanbus'. Make sure you are
root.
Probably you did not define your SCSI device.
Set the CDDA_DEVICE environment variable or use the -D option.

Regards.



-
10-Current-amd64-using ccache-portstree merged with marcuscom.gnome3  
xorg.devel

--
View this message in context: 
http://freebsd.1045724.n5.nabble.com/sata-ata-device-permission-for-user-tp5803691p5804740.html
Sent from the freebsd-questions mailing list archive at Nabble.com.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: sata/ata device permission for user

2013-04-18 Thread Polytropon
On Thu, 18 Apr 2013 00:32:09 -0700 (PDT), Beeblebrox wrote:
  The user also needs access to the corresponding pass device which is shown
 by camcontrol devlist. He also needs access to /dev/xpt0 I think. 

Correct, that matches my settings. :-)



 HL-DT-ST DVDRAM GSA-4165B DL05   at scbus6 target 0 lun 0 (cd0,pass3)
 
 crw---  1 root  operator  0x48 Apr 18 07:08 pass0
 crw---  1 root  operator  0x49 Apr 18 07:08 pass1
 crw---  1 root  operator  0x4a Apr 18 07:08 pass2
 crw---  1 root  operator  0x4b Apr 18 07:08 pass3
 crw---  1 root  operator  0x42 Apr 18 07:08 xpt0
 
 User is member of operator group.

But the group permissions are --- (none).



 However, I agree with your idea because
 just now I was working with cdrtools and got this error, but when I ran as
 root no error:
 
 % cdda2wav summary --device /dev/cd0
 cdda2wav: Permission denied. Open of /dev/xpt0 failed. Cannot open or use
 SCSI driver.
 cdda2wav: For possible targets try 'cdda2wav -scanbus'. Make sure you are
 root.
 Probably you did not define your SCSI device.
 Set the CDDA_DEVICE environment variable or use the -D option.

You should be able to see something like this:

% cdda2wav summary --device /dev/cd0
No target specified, trying to find one...
cdda2wav: Too many CD/DVD/BD-Recorder targets found.
scsibus0:
0,0,0 0) 'HL-DT-ST' 'DVDRAM GSA-H42N ' 'RL00' Removable CD-ROM
0,1,0 1) 'HL-DT-ST' 'DVD-ROM GDR8163B' '0L30' Removable CD-ROM
0,2,0 2) *
0,3,0 3) *
0,4,0 4) *
0,5,0 5) *
0,6,0 6) *
0,7,0 7) *
cdda2wav: Select a target from the list above and use 'cdda2wav dev=b,t,l'.


As it has been mentioned, access to xpt is also required.
It should be fine to set this via group permissions.

This is an example of possible settings:

linkcd0 dvd
own cd0 root:operator
permcd0 0660
own cd1 root:operator
permcd1 0660
own pass0   root:operator
permpass0   0660
own pass1   root:operator
permpass1   0660
own xpt0root:operator
permxpt00660

See man xpt for details.


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


sata/ata device permission for user

2013-04-18 Thread Beeblebrox
 But the group permissions are --- (none).
D'oh!
Well, that made a difference and I can query the cd0 device with cdda2wav as
my user now.

I still can't mount a data CD however.





-
10-Current-amd64-using ccache-portstree merged with marcuscom.gnome3  
xorg.devel

--
View this message in context: 
http://freebsd.1045724.n5.nabble.com/sata-ata-device-permission-for-user-tp5803691p5804757.html
Sent from the freebsd-questions mailing list archive at Nabble.com.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: sata/ata device permission for user

2013-04-18 Thread Ruben de Groot
On Thu, Apr 18, 2013 at 03:41:11AM -0700, Beeblebrox typed:
  But the group permissions are --- (none).
 D'oh!
 Well, that made a difference and I can query the cd0 device with cdda2wav as
 my user now.
 
 I still can't mount a data CD however.

What's the output of:

sysctl vfs.usermount

??

--
Ruben
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: sata/ata device permission for user

2013-04-18 Thread Beeblebrox
 What's the output of:  sysctl vfs.usermount 

vfs.usermount: 1

I can mount USB devices...



-
10-Current-amd64-using ccache-portstree merged with marcuscom.gnome3  
xorg.devel

--
View this message in context: 
http://freebsd.1045724.n5.nabble.com/sata-ata-device-permission-for-user-tp5803691p5804802.html
Sent from the freebsd-questions mailing list archive at Nabble.com.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: sata/ata device permission for user

2013-04-18 Thread Polytropon
On Thu, 18 Apr 2013 03:41:11 -0700 (PDT), Beeblebrox wrote:
  But the group permissions are --- (none).
 D'oh!
 Well, that made a difference and I can query the cd0 device with cdda2wav as
 my user now.
 
 I still can't mount a data CD however.

You need write access to the cd, pass and xpt devices.
You also need to _own_ the mount target directory. If
you try something temporary within your home directory,
it should always work:

% cd
% mkdir mnttest
% mount -o ro -t cd9660 /dev/cd0 mnttest

If you intend to mount below /media or into /cdrom or
/dvd, you need to set the proper owner. If you are
using X with the GiveConsole and TakeConsole script.
Then you can do things like this:

% mount /media/dvd

given that all the over information is preprogrammed
in /etc/fstab.




-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


sata/ata device permission for user

2013-04-14 Thread Beeblebrox
My user is unable to mount cdrom and cannot use qemu for the HDD devices. Why
is access to these devices being refused for my user?

1. % mount_cd9660 /dev/cd0 /cdrom
mount_cd9660: /dev/cd0: Operation not permitted

2. % qemu-system-x86_64 -hda /dev/ada2
qemu-system-x86_64: -hda /dev/ada2: could not open disk image /dev/ada2:
Operation not permitted

*SETTINGS:*
% id = uid=1001(xyz) gid=0(wheel) groups=0(wheel),5(operator),1001(xyz)

/etc/devfs.rules has:  [localrules=10]
add path 'ada[0-9]*' mode 0660 group operator
add path 'da[0-9]*' mode 0660 group operator
add path 'cd[0-9]*' mode 0660 group operator

/etc/rc.conf has:
devfs_system_ruleset=localrules

Regards.



-
10-Current-amd64-using ccache-portstree merged with marcuscom.gnome3  
xorg.devel

--
View this message in context: 
http://freebsd.1045724.n5.nabble.com/sata-ata-device-permission-for-user-tp5803691.html
Sent from the freebsd-questions mailing list archive at Nabble.com.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: sata/ata device permission for user

2013-04-14 Thread Polytropon
On Sun, 14 Apr 2013 01:11:38 -0700 (PDT), Beeblebrox wrote:
 My user is unable to mount cdrom and cannot use qemu for the HDD devices. Why
 is access to these devices being refused for my user?

Because there have to be certain permissions in order to allow
a non-root user perform such tasks:

1. The setting vfs.usermount=1 has to be present in /etc/sysctl.conf .

2. The user must have write access to the device file.

3. The user has to own the mount directory.

It helps if the user is in the wheel group.



 1. % mount_cd9660 /dev/cd0 /cdrom
 mount_cd9660: /dev/cd0: Operation not permitted

Check permissions of /dev/cd0 and /cdrom.



 2. % qemu-system-x86_64 -hda /dev/ada2
 qemu-system-x86_64: -hda /dev/ada2: could not open disk image /dev/ada2:
 Operation not permitted

Check permissions of /dev/ada2, maybe write permission is needed?



 *SETTINGS:*
 % id = uid=1001(xyz) gid=0(wheel) groups=0(wheel),5(operator),1001(xyz)
 
 /etc/devfs.rules has:  [localrules=10]
 add path 'ada[0-9]*' mode 0660 group operator
 add path 'da[0-9]*' mode 0660 group operator
 add path 'cd[0-9]*' mode 0660 group operator
 
 /etc/rc.conf has:
 devfs_system_ruleset=localrules

Looks correct, but doesn't seem to be sufficient. But take into
mind that /etc/devfs.rules is used for dynamically allocated devices,
and /etc/devfs.conf for those present at boot time (usually cd,
maybe also da and ada depending on your setup).



Also see:

http://forums.freebsd.org/showthread.php?t=5796

Compare to Handbook 19.5.2:

http://www.freebsd.org/doc/en/books/handbook/usb-disks.html

Maybe also helpful:

http://www.cyberciti.biz/faq/freebsd-allow-ordinary-users-mount-cd-rom-dvds-usb-removabledevice/


-- 
Polytropon
Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


sata/ata device permission for user

2013-04-14 Thread Beeblebrox
Hello,

1. Neglected to specify that vfs.usermount=1 is set in /etc/sysctl.conf. My
user can mount USB drives.

2. Settings in /etc/devfs.rules is being passed to system correctly because
ownership is correct:
crw-rw  1 root  operator  0x57 Apr 15 09:46 /dev/cd0

3. File permissions for /cdrom is
root  operator 2 Mar  3  2011 cdrom/
I had also tried mounting on a folder with 1777 permission before posting.

Otherwise,
* I had solved the qemu problem, it was a small oversight.

 It helps if the user is in the wheel group. 
Membership in operator should be sufficient...

 Looks correct, but doesn't seem to be sufficient. /etc/devfs.rules is
 used for dynamically allocated devices and /etc/devfs.conf for those
 present at boot time.
As far as I understand, you can set rules for any device in devfs.rules, but
not vice-versa. But I should also try with devfs.conf just to make sure...

Regards.




-
10-Current-amd64-using ccache-portstree merged with marcuscom.gnome3  
xorg.devel

--
View this message in context: 
http://freebsd.1045724.n5.nabble.com/sata-ata-device-permission-for-user-tp5803691p5803879.html
Sent from the freebsd-questions mailing list archive at Nabble.com.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


sata/ata device permission for user

2013-04-14 Thread Beeblebrox
EDIT: I had already placed in /etc/devfs.conf this entry some time ago:

# Allow members of group operator to mount cdrom
own /dev/cd0   root:operator
perm/dev/cd0   0660

Not allowing mount despite all of these adjustments (being tested with data
cd and NOT audio cd), which is what I am unable to figure out.



-
10-Current-amd64-using ccache-portstree merged with marcuscom.gnome3  
xorg.devel

--
View this message in context: 
http://freebsd.1045724.n5.nabble.com/sata-ata-device-permission-for-user-tp5803691p5803900.html
Sent from the freebsd-questions mailing list archive at Nabble.com.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org