0

When I connect my NTFS external hard drive via USB it auto-mounts. I don't know which mount options it used so I looked at the output of /proc/mounts which says

/dev/sdb1 /media/qwr/Elements fuseblk rw,nosuid,nodev,relatime,user_id=0,group_id=0,default_permissions,allow_other,blksize=4096 0 0

So it has default_permissions not permissions like this answer says the drive should be mounted with to preserve permissions. So does that option not preserve permissions? If I mount with permissions will copying files preserve permissions?

From ntfs-3g manpage:

Access Handling and Security

By default, files and directories are owned by the effective user and group of the mounting process, and everybody has full read, write, execution and directory browsing permissions. You can also assign permissions to a single user by using the uid and/or the gid options together with the umask, or fmask and dmask options.

Doing so, Windows users have full access to the files created by ntfs-3g.

But, by setting the permissions option, you can benefit from the full ownership and permissions features as defined by POSIX. Moreover, by defining a Windows-to-Linux user mapping, the ownerships and permissions are even applied to Windows users and conversely.

If ntfs-3g is set setuid-root then non-root users will be also able to mount volumes.

To test I copied a file with permissions -rw-r--r-- to the mounted drive. On the mounted drive pretty much every file and directory appears with all permissions -rwxrwxrwx or drwxrwxrwx. When I copied back to my home folder the file had permissions -rwxr-xr-x which I guess is the default. So it looks like permissions weren't preserved.

My usecase is to backup /home to an NTFS drive. I'm not sure if I should backup to a tarfile or if I can just rsync the files over.

2
  • NTFS has different permissions, so no all permissions won't be saved.
    – guiverc
    Mar 12, 2020 at 4:10
  • @guiverc the linked answer claims ntfs supports permissions
    – qwr
    Mar 12, 2020 at 4:10

1 Answer 1

0

Just copying files to another filesystem type is not guaranteed to preserve anything but the data -- filesystem attributes may differ. It's up to the backup tool you select to preserve those other attributes. You mention tar, and that would do the job for the basic permissions you mention. Access Control Lists -- probably not, so a more sophisticated tool would be needed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .