Changing file permissions on USB external hard drive
Solution 1
sudo chown -R $USER:$USER /media/FREECOM
Solution 2
I see that your disk is vfat, which unfortunately does not support file permissions win the current revision, unless you want to reformt it in UMDOS, which has been disconntinued and requires an older kernel. However, this may help get you
Ubuntu, and Linux in general, unfortunately have spotty permissios under other filesystems, especially on external disks, even without VFAT.
You may try these two other answers(In order of preference):
How do I set executable permissions on a removable drive?
Related videos on Youtube
foobarPho
Updated on September 18, 2022Comments
-
foobarPho over 1 year
I am using an external USB hard drive for a long time in Ubuntu 10.04, both at work and at home. Now I've installed 12.04 at home. Today I used the USB drive for the first time. I can read the disk but can't change the permissions of a file I wanted.
Output of "mount"
/dev/sdb1 on /media/FREECOM HDD type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077, utf8=1,showexec,flush,uhelper=udisks)
I try
sudo chmod u+w bsst-hdf_to_bsst-h5
and I get
-rw-r--r-- 1 paco paco 2956 dic 19 10:27 bsst-hdf_to_bsst-h5
Any ideas would be appreciated. Thanks in advance.
Hi again and sorry for the delay in answering. Now I have tried to copy the device line from fstab from 10.04 to the laptop with 12.04 but still get an error message.
Error mounting: mount exited with exit code 1: helper failed with: mount: only root can mount /dev/sdb1 on /media/FREECOM HDD
The line I add to fstab to try to mount the usb drive is
/dev/sdb1 /media/FREECOM\040HDD vfat rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,flush 0 0
When restoring original fstab and pluging the usb drive the output of mount is
/dev/sdb1 on /media/FREECOM HDD type vfat (rw,nosuid,nodev,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,showexec,flush,uhelper=udisks)
What should I add in fstab to get the drive fully working? I wanted to change permissions on files in the usb drive.
Thanks again
-
Admin almost 12 yearsHI, I tried sudo, no message. It seems it has run fine but ls -lrt just shows the same permissions than before
-
-
Rinzwind almost 12 yearsYou can use the $USER variable for both user and group ;)
-
Octávio Filipe Gonçalves almost 12 yearsyes ofcourse ;)
-
foobarPho almost 12 yearsHi, group and user are the right ones
-
foobarPho almost 12 yearsThe first solution does not work for me. I think I have to edit /etc/fstab. Maybe I wait until monday and look at the options at work on 10.04 and check for any differences at home.
-
nanofarad almost 12 years@pacomet you can try changing the 0022 code to suit your needs in the first answer--It will only act on ALL drives unless you set up some sort of filtering--same caveat with the second.
-
foobarPho almost 12 yearsHi, I'm not so experienced in linux to completely understand how to fix it. Do I only need to change the option "mode=0022"? Can you point me the right options or a place to read about them? Thanks
-
nanofarad almost 12 years@pacomet You may want to see this useful page with a nice code calculator. Also, sorry for bad info, but it should only be 3 digits(The link will give you just the right code in the 3 digits in the boxes)
-
nanofarad almost 12 yearsSorry, I saw that your drive is already 777. You cannot change the permissions, unless you want to set them for only your system when reading that drive(The changes will not propagate to other systems). This makes the permissions system-wide and acting on the entire drive. Also, why do you want permissions in the first place? Anyone with physical access to the drive can just get pas the permissions.
-
foobarPho almost 12 yearsHi Robert. I use this drive at work and sometimes I take it at home so I can work. Then, I just carry all of the data and executable scripts in the same place. Then I need to make scripts executable to run them in the hard drive. Just plug and play both at work and at home. Thanks
-
foobarPho almost 12 yearsHi, this is the entry on /etc/mtab at work (Ubuntu 10.04) that I will try to put in /etc/fstab at home (Ubuntu 12.04): /dev/sdc1 /media/FREECOM\040HDD vfat rw,nosuid,nodev,uhelper=udisks,uid=1000,gid=1000,shortname=mixed,dmask=0077,utf8=1,flush 0 0