1

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.

3 Answers 3

1

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.

1
  • This is the "proper" way to do it. Alternatively, if the device names aren't predictable, use sudo.
    – BowlesCR
    Jan 27, 2014 at 17:36
0

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.

6
  • If i format it to NTFS and use ntfs-3g instead of ext4.. Will it auto mount on user "pi"? Jun 22, 2013 at 6:24
  • Depends on other factors. Jun 22, 2013 at 6:25
  • Which factor, will you please explain? Jun 22, 2013 at 6:26
  • Whether or not you're running anything that will automount it. Jun 22, 2013 at 6:26
  • If you have any good tutorial in mind on how to setup transmission with external usb, please tell me. Jun 22, 2013 at 6:27
0

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.

3
  • Still not working! Jun 22, 2013 at 7:24
  • help me please! Jun 22, 2013 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, 2013 at 7:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .