0

I am trying to change the permission of a folder in a mounted hard drive.

I didn't use command line to mount (nautilus file manager mounted for me when I clicked on it).

After the drive was mounted, the permission looks like this:

$ ll /run/media/myuser/
drwx------ 1 myuser myuser  4096 Feb 16 09:27 XYZ

Then, I do

$ sudo ln -s /run/media/myuser/XYZ/myData /data
$ chown -R externaluser:externaluser /data
$ ll / | grep data
lrwxrwxrwx    1 externaluser externaluser    44 Mar  2 11:17 data -> /run/media/myuser/XYZ/myData

However, if I run

$ ll /run/media/myuser/XYZ | grep myData
drwx------ 1 myuser myuser     48 Mar  2 12:16 myData

The owner and group are still myuser even after I ran:

chown -R externaluser:externaluser /run/media/myuser/XYZ/myData

How can this be fixed?

Basically, I would like to give access of this folder only to an external user to rsync data to that folder but I don't want to give access to other folders in the same drive.

Thanks.

This is CentOS 7 if it matters.

HCSF
  • 165

1 Answers1

1

The symlink (ln -s command) and the directory are two different entities with their own ownership and permissions. If what you finally want is to give permission to externaluser to your real directory, you should write:

sudo chown -R externaluser:externaluser /run/media/myuser/XYZ/myData

Juan
  • 117
  • Thanks for pointing out my typo in my last command...I forgot to include externaluser:externaluser when I typed up my post (fixing...). Tho, I actually included it and the ownership of the folder didn't get changed :( – HCSF Mar 02 '19 at 12:56
  • please post the result of the following: stat /run/media/myuser/XYZ/myData;echo $?;stat /myData;echo $? – Juan Mar 03 '19 at 17:06
  • 1
    Juan, thanks for trying to help. As Kmail pointed out, it was because of how NTFS works. Hence, I reformatted the HD and set it to xfs and now I can set the permission properly. Thanks! – HCSF Mar 04 '19 at 00:39