How to control permissions on external USB hard disk
It all depends on the filesystem you are using on your external drive. Since you have mentioned that permission changing operations do not work, it is likely you have either NTFS or FAT32.
Since you want to make a backup, the best way to do that to different file-system would be to make an archive with a tool like tar
or similar. They have command switches for preserving permissions etc.
Regarding permissions of NTFS/FAT32 filesystems: while you can't control permissions of individual files or directories, you can specify permission which will be used when mounting the drive using dmask
, fmask
and umask
options:
-
uid
set the owner user of all files -
gid
set the owner group of all files -
dmask
controls permissions for directories -
fmask
controls permissions for files -
umask
controls the bitmask of the permissions that are not present (defaults to the umask of current process)
These can be either put into /etc/fstab
or just added to mount
command as -o
arguments:
$ mount -o uid=1000,gid=1000,dmask=027,fmask=137 /dev/sdXY /mnt
If you want to put it in /etc/fstab
instead, you have to put them under options
(4th column):
$ cat /etc/fstab
/dev/sdXY /mnt ntfs uid=1000,gid=1000,dmask=027,fmask=137 0 0