Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hi. My USB memory stick works OK for the root user but
not for non-root users. It gives the 'permission denied'
message when trying to write to it.
I know I can probably fix this in /etc/fstab. Here she is:
Since it's a USB stick, consider setting up automount for it, or configuring udev to symlink the mount point to a fixed /dev location so your fstab entry will continue to work even when you add other USB devices to your system.
There is also the fmask and dmask options to set the permissions for the mounted drive. I would recommend using either the label or UUID number to mount a thumb drive. The next time you insert it it might be assigned to a different device. Here is an example from an external usb drive formatted with the ext3 filesystem:
Thanks for the pointers gents.
I used emacs to change the /etc/fstab entry for the
memory stick device to 'users' instead of 'owner'
It worked and non-root users could write to it.
But when I rebooted the change was undone.
I changed it again and checked it and rebooted.
The change was undone again.
I must be changing it wrong.
Also, how do I specify automount?
I think I will give the users the root password so they
can continue to use the memory stick. This is a small
company so I can trust them as long as I can get it
to automount.
Even in a "small" company, giving users "root" privilege is not a good idea. In fact, it's not a good idea for you to run a "root" unless you need to do system maintenance. The problem with "root" privilege is that "accidents" can catastrophic if done by "root."
Your real problem seems to be that the USB stick settings are not "sticking" across a reboot. So the question I'd ask is, do you have the USB stick plugged in when you reboot, or do you plug it in later? (Or move it around?) Most modern Linux systems will automatically attach a USB stick when it's plugged in, but the mount is done by a script invoked by udev which doesn't use the fstab settings.
Much better would be to create a group (say, e.g., usb_users) and then use chown to reset the group owner flag on the files and directories on the USB stick, and chmod to give group members rw to the files on the stick. Since you've already created an ext3 file system on the stick, the permissions set on the file system entries in the stick should override any mount options.
Setting up automount can be tricky. There are tutorials available in the LinuxQuestions "Tutorials" link at the top of this page which might help, but that might be overkill for your needs. Try jschiwal's suggestion about labeling the file system on the stick. It's a good one I should have suggested myself. (The tune2fs can be used to change the label. Hum. Looking at the man tune2fs I notice that it can also be used to set the mount options for the file system. You might try that approach, and let us know if it works.
Last edited by PTrenholme; 09-24-2007 at 11:34 AM.
Reason: Incorrect reference
Thanks for the pointers gents.
I used emacs to change the /etc/fstab entry for the
memory stick device to 'users' instead of 'owner'
It worked and non-root users could write to it.
But when I rebooted the change was undone.
I changed it again and checked it and rebooted.
The change was undone again.
I must be changing it wrong.
Also, how do I specify automount?
I think I will give the users the root password so they
can continue to use the memory stick. This is a small
company so I can trust them as long as I can get it
to automount.
thanks............don
How were the changes undone? Is the /etc/fstab file back the way it was before?
The "user" option allows a regular user to mount that partition without having to mount it as root.
You might want to try "users" instead if more than one user wants to mount the same pendrive.
If each user has their own pen drive, then you can have an fstab entry for each user. Using "UUID=" or "LABEL=" instead of a device and the "user", "dmask" & "fmask" options will allow controlling access to each respective pendrive (on the same machine) without the respective users needing to know the root password.
note: dmask & fmask assumes that the thumbdrive use a FAT filesystem. For a linux filesystem, use chown & chmod instead.
---
Note: by default, you can allow members of a group to execute the mount command by using the sudoers file. It is edited using the visudo program. The mount & umount commands are in a commented line. So you remove the comment character (#). Also, by default, the users own password is used for authentication rather than the root password.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.