amyren
Posts: 91
Joined: Tue Jun 12, 2012 10:49 am

Password for mounting USB disks

Thu Sep 06, 2012 6:37 am

This I find a bit annoying inside raspian. It turns out I need root access to use my USB HDD or USB sticks, and every time I insert them I get prompted for the password.
Is there a way to avoid having to do this every time?

User avatar
jojopi
Posts: 3271
Joined: Tue Oct 11, 2011 8:38 pm

Re: Password for mounting USB disks

Thu Sep 06, 2012 6:44 am

Which raspbian image are you using? In the foundation's recommended images there is no root password set, and sudo does not require any password.

amyren
Posts: 91
Joined: Tue Jun 12, 2012 10:49 am

Re: Password for mounting USB disks

Thu Sep 06, 2012 7:50 am

jojopi wrote:Which raspbian image are you using? In the foundation's recommended images there is no root password set, and sudo does not require any password.
Sorry, forgot to add that it is raspian. I have not set any password myself, but it does ask for password.
If I use a terminal command and use sudo, I never need a password. But it does as for password when mounting disks.

bredman
Posts: 1415
Joined: Tue Jan 17, 2012 2:38 pm

Re: Password for mounting USB disks

Thu Sep 06, 2012 8:11 am

You forgot to set the user when mounting the disk, this is why only root has write access to the disk.

When you specify the mount parameters in /etc/fstab, you need to specify the owner of the disk. For example, if you are mounting a Windows disk, you should specify uid=pi,gid=pi to set the user pi as the owner of this disk.

To edit the fstab file, use the command
sudo nano /etc/fstab

For the options available for different disk types, see
http://en.wikipedia.org/wiki/Fstab

amyren
Posts: 91
Joined: Tue Jun 12, 2012 10:49 am

Re: Password for mounting USB disks

Thu Sep 06, 2012 7:29 pm

Thanks.
I did a try at fstab, but I must be doing something wrong..
My WD Passport 500GB HDD is NTFS formatted.
From the wiki:
/dev/sda1 /mnt/Windows ntfs-3g quiet,defaults,locale=en_US.utf8,umask=0,noexec 0 0

I did try, but then got error at boot due to ntfs-3g, filesystem does not exist. I then tried only ntfs, and that error was gone.
. Here is what I did try.
/dev/sda1 /mnt/usbhdd ntfs uid=pi,gid=pi 0 0

But during startup I can see a message in red text, Failed, mountpoint /mnt/usbhdd does not exist.
And after startx, my disk is not available at all.
I also tried to: sudo mkdir /mnt/usbhdd
Then the fail doesnt show, but there is a warning about its read only
But back on the desktop the disk does not show. And trying to open folder /mnt/usbhdd I get an error message that I have no permission.

Any ideas what I do wrong?

Return to “Beginners”