3

I'm using RHEL 6.5, andhave an auto-mounted external USB drive. Any and all files created in the mounted filesystem are given permission 700 for dirs and 777 for files. The chmod command does not change the permissions.

I want to use rsync to backup my files to the drive, but I don't want to lose my permission settings. My trial runs with "rsync -avh" preserve the time stamps and the user and group settings, but not permissions.

Where are these being controlled for such a drive, and how can I turn off this forced setting?

  • 1
    What Filesystem is being used on the drive ? and what mount options ? – Lawrence May 12 '14 at 6:32
3

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
  • Curses, it is indeed NTFS. I should have known to format it to ext4 first. But thanks for the help with the mount options. Those will be useful! – Craig May 12 '14 at 14:47

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.