LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to allow a user access to a USB drive (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-allow-a-user-access-to-a-usb-drive-370602/)

Gnarg 10-07-2005 07:43 AM

How to allow a user access to a USB drive
 
Hi All,

When I plug my Lexar Jumpdrive in my USB port ( as root ) I run a mount command:
Code:

mount -t vfat /dev/sda1 /mnt/usb
No warning or errors occur so I now can access my usb drive. However when the drive is mounted and I use my normal user's account I do not have permission to access /mnt/usb. I can go to /mnt just not the sub folders.

I tried chmod 766 /mnt/usb (as root) and even added the -R option and still wont change permission so any other user other then root cannot access the drive.

I added the following in fstab but still no change.

Code:

/dev/sda1 /mnt/usb vfat noauto,rw,user 0 0
Any clues as to what I'm doing wrong. All I need to my regular user to have access to my usb drive and I rather not use root to have only access to it.


Gnarg
:study:

Emerson 10-07-2005 07:57 AM

Dunno about Mandrake, under Gentoo your user has to be member of usb group.

Gnarg 10-07-2005 08:07 AM

Thanks for the reply Emerson,

I do have that user in the usb group and still keep getting permission denied.

I did notice something though, in ~/mnt/usb ( users account ) has the group and owner for regular users. Only root can mount the USB drive so when I mount using root to my users home folder/mnt/usb the ownership changes to root:root.

Gnarg

Emerson 10-07-2005 08:21 AM

I have an USB multifunction flashcard reader. Never used it with my Gentoo box. Now I plugged it in first time. First I saw a message on console announcing /media/usbdisk directory is created. Then I opened my fstab and saw a new line
Code:

/dev/sdd1              /media/usbdisk          vfat    user,exec,noauto,utf8,noatime,sync,managed 0 0
Next I tried to mount it as user - no problems at all. So my attempt to replicate your problem failed :(

Gnarg 10-07-2005 08:40 AM

Well I thought I'd copy your parameters for fstab and still no luck. I can only mount as root and I still keep getting permission denied messages when trying to access the usb drive. :(


Gnarg

imitheos 10-07-2005 10:28 AM

Re: How to allow a user access to a USB drive
 
Quote:

Originally posted by Gnarg
Hi All,

When I plug my Lexar Jumpdrive in my USB port ( as root ) I run a mount command:
Code:

mount -t vfat /dev/sda1 /mnt/usb
No warning or errors occur so I now can access my usb drive. However when the drive is mounted and I use my normal user's account I do not have permission to access /mnt/usb. I can go to /mnt just not the sub folders.

I tried chmod 766 /mnt/usb (as root) and even added the -R option and still wont change permission so any other user other then root cannot access the drive.

I added the following in fstab but still no change.

Code:

/dev/sda1 /mnt/usb vfat noauto,rw,user 0 0
Any clues as to what I'm doing wrong. All I need to my regular user to have access to my usb drive and I rather not use root to have only access to it.


Gnarg
:study:

Firstly, when you mount the flash as root you don't have access permission as a user because mount changes the permissions
(because it is a vfat drive).

Regarding, the fact that you can't mount it.
The line from /etc/fstab seems ok to me unless i am forgeting something.
The first thing that comes to my mind is that you don't have read permissions on /dev/sda1 as user.
do a "ls -al /dev/sda1" and see what are the permissions.

morrolan 10-07-2005 10:42 AM

You can also try adding "umask=0222" after "auto,user" etc. That works for NTFS partitions - when Root can read and a User can't, that was the solution I found.

Gnarg 10-07-2005 01:07 PM

Hi imitheos,


I ran the command and here is the output

lr-xr-xr-x 1 root root 34 Sep 25 14:00 /dev/sda1 -> scsi/host4/bus0/target0/lun0/part1




morrolan, I also did as you suggested and it did not work. There's a change I entered it wrong so here's a snippet:

Code:

/dev/sda1    /mnt/usb  vfat    user,exec,noauto,utf8,noatime,sync,managed,umask=0222  0 0

On another note since I'm editing /etc/fstab should I reboot after every change? That's what I've been doing so far.

Gnarg
:study:

imitheos 10-07-2005 04:06 PM

Quote:

Originally posted by Gnarg
Hi imitheos,


I ran the command and here is the output

lr-xr-xr-x 1 root root 34 Sep 25 14:00 /dev/sda1 -> scsi/host4/bus0/target0/lun0/part1

You use DevFS and so /dev/sda1 is a link to the real device.
so you should also do a "ls -al /dev/scsi/host4/etc/etc"

Quote:

Originally posted by Gnarg
morrolan, I also did as you suggested and it did not work. There's a change I entered it wrong so here's a snippet:

Code:

/dev/sda1    /mnt/usb  vfat    user,exec,noauto,utf8,noatime,sync,managed,umask=0222  0 0

On another note since I'm editing /etc/fstab should I reboot after every change? That's what I've been doing so far.

Gnarg
:study:

It didn't work because you have a vfat filesystem. With ntfs you can use umask.

Gnarg 10-07-2005 07:28 PM

Hmmmm very odd.


The problem I have does not happen at home. My home Gentoo box I added the information into fstab and worked for me. My normal user can access the drive with no problems.

Now its just my work computer I have the problem on. I must have done something wrong. This I can work with and I will be able to find my problem at work.

Thanks for your help, I would never have figured out how to do this. :)



Gnarg
:D


All times are GMT -5. The time now is 12:20 PM.