LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-07-2005, 07:43 AM   #1
Gnarg
Member
 
Registered: Feb 2004
Location: Canada
Distribution: Gentoo Linux
Posts: 44

Rep: Reputation: 15
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
 
Old 10-07-2005, 07:57 AM   #2
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Dunno about Mandrake, under Gentoo your user has to be member of usb group.
 
Old 10-07-2005, 08:07 AM   #3
Gnarg
Member
 
Registered: Feb 2004
Location: Canada
Distribution: Gentoo Linux
Posts: 44

Original Poster
Rep: Reputation: 15
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
 
Old 10-07-2005, 08:21 AM   #4
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
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
 
Old 10-07-2005, 08:40 AM   #5
Gnarg
Member
 
Registered: Feb 2004
Location: Canada
Distribution: Gentoo Linux
Posts: 44

Original Poster
Rep: Reputation: 15
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
 
Old 10-07-2005, 10:28 AM   #6
imitheos
Member
 
Registered: May 2005
Location: Greece
Posts: 441

Rep: Reputation: 141Reputation: 141
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
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.
 
Old 10-07-2005, 10:42 AM   #7
morrolan
Member
 
Registered: Sep 2003
Location: Manchester UK
Posts: 264

Rep: Reputation: 30
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.
 
Old 10-07-2005, 01:07 PM   #8
Gnarg
Member
 
Registered: Feb 2004
Location: Canada
Distribution: Gentoo Linux
Posts: 44

Original Poster
Rep: Reputation: 15
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
 
Old 10-07-2005, 04:06 PM   #9
imitheos
Member
 
Registered: May 2005
Location: Greece
Posts: 441

Rep: Reputation: 141Reputation: 141
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
It didn't work because you have a vfat filesystem. With ntfs you can use umask.
 
Old 10-07-2005, 07:28 PM   #10
Gnarg
Member
 
Registered: Feb 2004
Location: Canada
Distribution: Gentoo Linux
Posts: 44

Original Poster
Rep: Reputation: 15
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
user access to second hard drive.. jsheffie SUSE / openSUSE 6 11-01-2005 03:34 PM
new user- can't access my flash drive kebi Linux - Software 1 08-17-2005 11:04 AM
Unable to access Konqueror with USB drive plugged in user mode richdux Mandriva 3 03-10-2005 07:27 PM
User cannot access d drive rfsatxeng Slackware 8 01-17-2004 07:27 AM
user cannot access d drive rfsatxeng Linux - Newbie 5 01-17-2004 01:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration