Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am new to UNIX and I have been trying to setup Transmission on my new Raspberry Pi. I have formatted my external USB drive to ext4 and added the following line to the /etc/fstab.

/dev/sda1         /media/USB96    ext4    defaults           0       0

It works fine but when I login as pi (instead of root) it returns an error when mounting the drive

mount: only root can do that

I'm stuck here because when I try to download a torrent with the Transmission web interface it also returns an error:

Permission denied (/media/USB96/torrents/complete/my torrent link)

Please help me to solve this problem and tell me how to allow the normal user pi to mount and have access to the USB drive.

share|improve this question
add comment

3 Answers

You should change your /etc/fstab entry to this:

/dev/sda1         /media/USB96    ext4    defaults,user           0       0

According to the fstab(5) manpage, the user option allows any user to mount the file system.

share|improve this answer
    
This is the "proper" way to do it. Alternatively, if the device names aren't predictable, use sudo. –  BowlesCR Jan 27 at 17:36
add comment

ext4 (and indeed most *nix-native filesystems) are not meant to be used on removable media for not only the reason you've found, but also because of things such as user and group IDs. Reformat the drive to something foreign, such as VFAT or NTFS.

share|improve this answer
    
If i format it to NTFS and use ntfs-3g instead of ext4.. Will it auto mount on user "pi"? –  Damanjit Singh Jun 22 '13 at 6:24
    
Depends on other factors. –  Ignacio Vazquez-Abrams Jun 22 '13 at 6:25
    
Which factor, will you please explain? –  Damanjit Singh Jun 22 '13 at 6:26
    
Whether or not you're running anything that will automount it. –  Ignacio Vazquez-Abrams Jun 22 '13 at 6:26
    
If you have any good tutorial in mind on how to setup transmission with external usb, please tell me. –  Damanjit Singh Jun 22 '13 at 6:27
show 1 more comment

The pi user shouldn't need to mount the USB drive. By adding that line to the /etc/fstab file, the USB drive will be automatically mounted when the Pi boots up.

The problem you are experiencing is with permissions. The root user is likely the owner of /mnt/USB96, unless you explicitly changed it. This means that, unless the permissions have been altered for the directory, only root can create new files/folders within. This can be verified with

$ ls -l /media/USB96

To change the owner of /media/USB96 and all of the subdirectories withen to pi so that Tranmission can write to the directory, execute the following as root with the USB drive mounted:

# chown -R pi:pi /media/USB96

Then try downloading a torrent again.

share|improve this answer
    
Still not working! –  Damanjit Singh Jun 22 '13 at 7:24
    
help me please! –  Damanjit Singh Jun 22 '13 at 7:32
    
Sorry. I meant /media/ instead of /mnt/. Check my edit above. If you noticed this already, as pi, can you cd /media/USB96 and create a file with touch test.file? If not, what error does it throw? –  Rain Jun 22 '13 at 7:43
add comment

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.