I have an external hard drive connected to my Linux box. I wanted to setup a web server to access files on it, but the permission on all files and directories on the drive are rwx for the owner which is my local login, and the group is the root group.

I need the files readable by the apache user, I was trying to set all files to be chmod a+rwx -R *, but this doesn't do anything (gives no errors, just has no effect.) I tried changing the group using chgrp to my user group, but that won't work either, it gives me errors that I lack permission even when I run all those commands as sudo!

What's up with this hard drive??? sudo chmod a+rwx * should work on anything, right?

5 Answers 5


Check the filesystem type it's using first with df -T:

sys@p:~$ df -T
Filesystem    Type   1K-blocks      Used Available Use% Mounted on
ext3          ext3    19222656   1050948  17195164   6% /
tmpfs        tmpfs     1684988         0   1684988   0% /lib/init/rw
udev         tmpfs       10240        64     10176   1% /dev
tmpfs        tmpfs     1684988         0   1684988   0% /dev/shm

If it's mounted on /mnt/external for example you will see that in the far right column. You can see the filesystem type in the second column. If it's NTFS, you'll want NTFS-3G (probably already installed, if not sudo apt-get install ntfs-config then gksu ntfs-config). Linux already has FAT support for read & write although they do not support permissions.

If you want an NTFS partition mounted with ownership applied to a specific user/group, specify it in the mount switches:

mount -o uid=username,gid=groupname /dev/sdc /path/to/mount

If you change to ext3 as suggested above, you can use chown:

chown -R user *
chown -R user .

As Kim said, you'll only get Unix permissions and ownership on a Unix filesystem. ext3 is a good candidate.

If you must use this drive without reformatting, you can do it with options to the mount command that specify the owner, group, and/or read/write permissions. These options affect all files on the drive (see John T's answer for how to determine the FSTYPE):

# list files as owned by X, use numerical UID as found in /etc/passwd
$ mount -t <FSTYPE> -o uid=X /dev/?? /path/to/mount/point

# list files as owned by group Y, use numerical GID found in /etc/passwd
$ mount -t <FSTYPE> -o gid=Y /dev/?? /path/to/mount/point

# list files as accessible per umask 
#   (022 gives rwx permissions to owner, r-x permissions to everyone else)
$ mount -t <FSTYPE> -o umask=022 /dev/?? /path/to/mount/point

# combine all of the above:
$ mount -t <FSTYPE> -o uid=X,gid=Y,umask=022 /dev/?? /path/to/mount/point

I did this and it worked:

sudo umount /dev/sda3 /media/windows1
sudo umount /dev/sda5 /media/windows2

and then

sudo mount -o rwx /dev/sda3 /media/windows1
sudo mount -o rwx /dev/sda5 /media/windows2

Note that I am Using Ubuntu 11.10 and sda3 is my Windows C:, sda5 is G:.


So, I had a bit of a time, since I had backups from multiple machines on the same drive. I had to install hdfsplus utilities (hfsprogs), then mount the drive, and finally change ownership of the relevant folders using both the user and group name.

Note: you can list the mount points and devices by just typing mount at the terminal.


sudo apt-get install hfsprogs

Then unmount your drive if it has already been mounted:

sudo umount /media/user/mount_point

(Re)Mount the drive using the following args:

sudo mount -t hfsplus -o force,rw /dev/sdb# /media/user/mount_point

Navigate to the directory containing the problem folders. Then do:

chmod -R your_user_group:your_user_name ./target_directory

Hope that helps.

  • This is the only one of the solutions that worked for me. Tried all of the others. Thanks!
    – SolStack
    Mar 7, 2020 at 3:01

It's probably formatted as FAT, which doesn't support file permissions. Use ext3 instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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