1

In my home (/Users/) folder I have many files migrated from previous installations, with different Owners and Permissions set. /User shows I have three Users set in addition to Guest and Shared. I have used Finder to change permissions for all files to allow me as current User to read/write all. I would like to keep one other user, in addition to Guest and Shared, as admin only to allow access for repair etc.

How can I set myself as Owner of all files with full r/w (and x) access, so I can delete the then-un-needed Users, keeping Shared and Guest?

8
  • Please edit the question down to the actual problem you want to solve.
    – nohillside
    Commented Feb 15, 2022 at 20:21
  • Maybe three questions: 1. When using chmod to change owner, do you have to be the original owner, or can this be done by root regardless of original ownership 2. Is it possible in Monterey to chmod files/folders created in previous OS's (seems like an odd question but I have read different answers on how to chmod depending on which OS is being considered) 3. How to apply chmod to change ownership of all files and folders it is safe to change. Tks R
    – rico1
    Commented Feb 15, 2022 at 21:59
  • Trying to recast the question:
    – rico1
    Commented Feb 16, 2022 at 11:09
  • In my home (/Users/<name>) folder I have many files migrated from previous installations, with different Owners and Permissions set. /User shows I have three Users set in addition to Guest and Shared. I have used Finder to change permissions for all files to allow me as current User to read/write all. I would like to keep one other user, in addition to Guest and Shared, as admin only to allow access for repair etc. How can I set myself as Owner of all files with full r/w (and x) access, so I can delete the then-un-needed Users, keeping Shared and Guest?
    – rico1
    Commented Feb 16, 2022 at 11:34
  • 1
    Why can't you just copy the data you want to keep into /Users/usertokeep and then remove the two other folders?
    – nohillside
    Commented Feb 16, 2022 at 22:09

2 Answers 2

1

If I have understood your question properly:

  • you have a load of documents
  • you would like to ensure that userA is owner of the files
  • you would like to ensure that userA has read and write access to the files
  • you would also like to have a separate admin account that you use for system changes and not for everyday tasks

Have I got that right? If so,

  • Move the documents you would like to keep into /Users/adminA/Public/backup. Use terminal and the mv command: mv /Users/userB/Documents/School /Users/adminA/Public/backup
  • Log in as adminA and open terminal
  • id userA. In the results you will see gid=XXX (YYY), probably gid=20(staff). Make a note of the YYY
  • sudo chown -R userA:YYY “/Users/adminA/Public/backup”. This will change the owner of all the collated files and directories to userA
  • sudo find “/Users/adminA/Public/backup” -type f -exec chmod u=rw,g=rw,o= {} \;
  • sudo find “/Users/adminA/Public/backup” -type d -exec chmod u=rwx,g=rwx,o= {} \; The last 2 commands give userA read and write access to all of the files, and read/write/execute access over all subdirectories (execute access is needed to search in directories). At this point the group permissions bits are set the same so that we can move the files over from adminA's Documents to userA's Documents directory. You shouldn’t give userA executable access (‘x’) to all of the files because: (I imagine?) most of the files aren’t executable files. Giving files unnecessary executable access is a habit best (and easily) avoided.
  • mv /Users/adminA/Public/backup /Users/userA/Documents
  • (Now if you want to you could log in as userA, open terminal, and run find “/Users/userA/Documents/backup” -type f -exec chmod u=rw,g=,o= {} \;...
  • ... and find “/Users/userA/Documents/backup” -type d -exec chmod u=rwx,g=,o= {} \; to remove group access to the files and subdirectories. This wouldn't really stop the admin account from accessing the files because they can always change permissions but it would stop other user accounts that exist (/will exist) in the staff group.
10
  • 1
    It is probably that the last two commands are not needed as if the files have been created by normal activities the original owner will have the needed permissions - but doing then won't do any harm
    – mmmmmm
    Commented Feb 17, 2022 at 19:48
  • 1
    @mmmmmm agreed! I just thought I add them for completeness just in case the user has custom permissions set on their home directory
    – We'll See
    Commented Feb 17, 2022 at 20:03
  • Thanks - that seems to be exactly the answer I was looking for. If I could ask one more question:
    – rico1
    Commented Feb 17, 2022 at 23:42
  • In considering this I realised I need to keep the original creation date (or as close to it as poss, date last modified will do) for search/archive purposes. Will your answer(s) do this? Tks
    – rico1
    Commented Feb 17, 2022 at 23:43
  • Have edited answer to include this requirement. Basically you need to use cp -p in terminal. Have also changed answer to use adminA/Public to make it easier to collate files from different user accounts
    – We'll See
    Commented Feb 18, 2022 at 8:30
0

The pragmatic answer is you can't change in a durable manner the ownership / permissionsof these folders as the system will "fix" them according to it's design any update and any time it writes new files.

Deeper down, some specific applications will refuse to run with overly permissive permissions.

It might be easier to move the files you wish to share openly outside your home folder if you need more than one "local account" to access them. Changes to the permissions in /Users/Shared is more durable than trying to override the design of ~ your home folder - especially for hidden and system like files stores in your user home folder.

Have you explored making a group permission change to allow access? I wonder if a small subset of the files are the only ones you need to "relax" permissions on.

Also, copying the files to an external drive is often very good so you can then ignore the permissions on that drive itself and then copy back the files to a place with default permissions needed.

2
  • Actually, if you delete a user, you are given the option to keep the files. After that, you can (with sudo) change owner and any other attributes. And if you change owner first, you don't need sudo for the rest.
    – WGroleau
    Commented Nov 15, 2022 at 18:34
  • Good idea @WGroleau - copying them to an external can avoid the need for chown / chmod entirely - just one Finder auth to make the copy out and a second one to delete the local copy.
    – bmike
    Commented Nov 15, 2022 at 18:47

You must log in to answer this question.

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