Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I plug in my external hard-drive when running KDE, it prompts me to mount the device (by clicking an icon, no sudo involved), and once I've done that I am the owner of the files. This is great.

When using other window managers (awesome, fluxbox, etc), I have to mount manually (sudo mount...) and thus root becomes the owner. sudo chown -R myname /mount_point just gives me "operation not permitted" errors. How can I make myself as user the owner of the file system on the external drive?

I use this drive for backups and having to do that as root is tedious (and I wouldn't be surprised if it's dangerous as well).

share|improve this question

2 Answers 2

up vote 2 down vote accepted

You should add a line to your /etc/fstab file with the path to your device, the path to where you want to mount it, then include "user,noauto" as the file system mount options. This will keep the system from trying to mount it at boot time, but allow you to mount the device as an ordinary user without using sudo. For example here is a line I use to mount my sd card reader:

 /dev/sdf1  /mnt/sd auto    noauto,user 1   1

Then I can just mount /mnt/sd as an ordinary user any time I want to access my card.

share|improve this answer
    
Does the system need to be rebooted for this to take effect? –  Wolf Jun 21 '11 at 20:44
    
@Wolf: No. Once it's saved in fstab you should be able to run the mount command. It checks the file every time it runs. –  Caleb Jun 21 '11 at 20:45
    
@Caleb: Great! Thanks! For now I'll go with this. It could get more complicated because the computer has 2 front USB ports, the system seems to assign /dev/sdc to whichever is connected first, and it could therefore be anything; and ultimately it would be cool to have different mount points depending on which device is attached (KDE seems to be able to do this, reading something from the external device to create /media/VERBATIM when I plug in the Verbatim external drive); but that's a project for later. –  Wolf Jun 21 '11 at 20:52
    
There are lots of ways you could automate this, such as custom hal rules, xmonad, or pmount. You might want to look into pmount as the simplest next step, but your distro may have other tools for this by default. My answer above is the most manual way to do it. –  Caleb Jun 21 '11 at 21:01
1  
The user option just lets you mount it without sudo. To make the files be owned by you, you need to use the uid= option. –  psusi Jun 21 '11 at 21:47

You could also consider running a standalone volume manager as discussed here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.