Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved]How to mount usbdisk as non-root user?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
LaoLiulaoliu
Apprentice
Apprentice


Joined: 31 Dec 2006
Posts: 199
Location: Nanjing,Jiangsu

PostPosted: Wed Oct 24, 2007 5:16 am    Post subject: [solved]How to mount usbdisk as non-root user? Reply with quote

Everytime I have to mount /dev/sdb1 /mnt/usb as the root user.Now I just want to mount it as a normal user.
I have already add my username xxx to the line:usb in the file /etc/group,but the bash told me that: mount: only root can do that
_________________
Gentoo(~x86)+fvwm && Debian+gnome
Intel Pentium D,Intel Mobile GM965/GL960 Integrated


Last edited by LaoLiulaoliu on Thu Oct 25, 2007 5:34 am; edited 1 time in total
Back to top
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Wed Oct 24, 2007 5:19 am    Post subject: Reply with quote

You need to add the "user" or "users" option to the entry for the usb device in /etc/fstab, read the mount man page for details.
_________________
"You have to invite me in"
Back to top
View user's profile Send private message
LaoLiulaoliu
Apprentice
Apprentice


Joined: 31 Dec 2006
Posts: 199
Location: Nanjing,Jiangsu

PostPosted: Wed Oct 24, 2007 7:12 am    Post subject: Reply with quote

Hopeless wrote:
You need to add the "user" or "users" option to the entry for the usb device in /etc/fstab, read the mount man page for details.

There is no usb in fstab,but I add "user" in /etc/mtab ,but still can not.

butterfly@localhost ~ $ mount
/dev/sda7 on / type ext3 (rw,noatime)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec)
udev on /dev type tmpfs (rw,nosuid)
devpts on /dev/pts type devpts (rw,nosuid,noexec)
/dev/sda1 on /mnt/debian type ext3 (rw)
/dev/sda5 on /learn type reiserfs (rw)
/dev/sda6 on /home type ext3 (rw)
/dev/sda8 on /mnt/sda8 type ext3 (rw)
/dev/sda10 on /boot type ext3 (rw)
/dev/sda2 on /mnt/sda2 type ext3 (rw)
shm on /dev/shm type tmpfs (rw,noexec,nosuid,nodev)
usbfs on /proc/bus/usb type usbfs (rw,user,noexec,nosuid,devmode=0664,devgid=85)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)

butterfly@localhost ~ $ mount /dev/sdb1 /mnt/usbfs/
mount: only root can do that
_________________
Gentoo(~x86)+fvwm && Debian+gnome
Intel Pentium D,Intel Mobile GM965/GL960 Integrated
Back to top
View user's profile Send private message
fangorn
Veteran
Veteran


Joined: 31 Jul 2004
Posts: 1886

PostPosted: Wed Oct 24, 2007 7:56 am    Post subject: Reply with quote

To clear this up. To make a user able to mount, there needs to be an entry in /etc/fstab like this one
Code:
/dev/external/disk6    /mnt/extern          reiserfs   noauto,user,exec      0 0

this assumes that there is an udev rule that maps /dev/sdxy to /dev/external/disky, regardless if your usb device gets /dev/sdb, /dev/sdc, ...
Put something like this in your /etc/udev/rules.d/10_local.rules
Code:

BUS=="scsi", SYSFS{model}=="OneTouch III    ", SYSFS{vendor}=="Maxtor  ", NAME{all_partitions}="external/disk"

The according parameters for your device you get by pluging in your device and running
Code:

udevinfo -a -p /sys/block/sdx

where sdx is the according device. You can get that by running "dmesg | tail" some seconds after you plugin the device.
_________________
Video Encoding scripts collection | Project page
Back to top
View user's profile Send private message
LaoLiulaoliu
Apprentice
Apprentice


Joined: 31 Dec 2006
Posts: 199
Location: Nanjing,Jiangsu

PostPosted: Wed Oct 24, 2007 8:52 am    Post subject: Reply with quote

I have add the follows to /etc/fstab
/dev/sdb1 /mnt/usbfs vfat noauto,user,exec 0 0

And follow your instruction build this file /etc/udev/rules.d/10_local.rules
BUS=="scsi", SYSFS{model}=="OneTouch III ", SYSFS{vendor}=="Maxtor ", NAME{all_partitions}="external/disk"

And run udevinfo -a -p /sys/block/sda and udevinfo -a -p /sys/block/sdb
I see something that I can not understand.
Then run dmesg | tail ,it shows:
[ 1077.429864] sd 2:0:0:0: [sdb] Mode Sense: 0b 00 00 08
[ 1077.429868] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[ 1077.448859] sd 2:0:0:0: [sdb] 1014527 512-byte hardware sectors (519 MB)
[ 1077.455839] sd 2:0:0:0: [sdb] Write Protect is off
[ 1077.455843] sd 2:0:0:0: [sdb] Mode Sense: 0b 00 00 08
[ 1077.455846] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[ 1077.455850] sdb: sdb1
[ 1077.469918] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[ 1077.469977] sd 2:0:0:0: Attached scsi generic sg1 type 0
[ 1077.471442] usb-storage: device scan complete


I run mount /dev/sdb1 /mnt/usbfs,the problem still--mount: only root can do that
_________________
Gentoo(~x86)+fvwm && Debian+gnome
Intel Pentium D,Intel Mobile GM965/GL960 Integrated
Back to top
View user's profile Send private message
Sadako
Advocate
Advocate


Joined: 05 Aug 2004
Posts: 3792
Location: sleeping in the bathtub

PostPosted: Wed Oct 24, 2007 3:05 pm    Post subject: Reply with quote

LaoLiulaoliu wrote:
I have add the follows to /etc/fstab
/dev/sdb1 /mnt/usbfs vfat noauto,user,exec 0 0

And follow your instruction build this file /etc/udev/rules.d/10_local.rules
BUS=="scsi", SYSFS{model}=="OneTouch III ", SYSFS{vendor}=="Maxtor ", NAME{all_partitions}="external/disk"

And run udevinfo -a -p /sys/block/sda and udevinfo -a -p /sys/block/sdb
I see something that I can not understand.
Then run dmesg | tail ,it shows:
[ 1077.429864] sd 2:0:0:0: [sdb] Mode Sense: 0b 00 00 08
[ 1077.429868] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[ 1077.448859] sd 2:0:0:0: [sdb] 1014527 512-byte hardware sectors (519 MB)
[ 1077.455839] sd 2:0:0:0: [sdb] Write Protect is off
[ 1077.455843] sd 2:0:0:0: [sdb] Mode Sense: 0b 00 00 08
[ 1077.455846] sd 2:0:0:0: [sdb] Assuming drive cache: write through
[ 1077.455850] sdb: sdb1
[ 1077.469918] sd 2:0:0:0: [sdb] Attached SCSI removable disk
[ 1077.469977] sd 2:0:0:0: Attached scsi generic sg1 type 0
[ 1077.471442] usb-storage: device scan complete


I run mount /dev/sdb1 /mnt/usbfs,the problem still--mount: only root can do that
Once you have the entry in fstab (and sorry about assuming you already did before), you no longer need to specify the device, just the mountpoint, IIRC you still have to be root to specify the device, even if the exact same device is associated with the mountpoint in fstab.

In short, just do `mount /mnt/usbfs` as a normal user.
_________________
"You have to invite me in"
Back to top
View user's profile Send private message
Angry_Red_Antz
Tux's lil' helper
Tux's lil' helper


Joined: 31 Mar 2005
Posts: 103
Location: Pittsfield, Massachusetts, But 100% Boricua

PostPosted: Wed Oct 24, 2007 4:32 pm    Post subject: Reply with quote

I'm having the same problem, even though I did follow all your instructions
You think that if I reformat the drive it may help?, the only thing is this usbdrive I use
I also mount it in Win at school
_________________
Show me the Linux!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum