67

I have an external hard drive attached, and I need to set permissions to be 'free' for the user MyUser.

I think I need to set the owner to MyUser also.

How can I do this via terminal?

2 Answers 2

133

Find out the name of your external hard drive first, then navigate to:

cd /Volumes/your-drive/

Now, to give your current user ownership to all files:

sudo chown -R $(whoami) .

Or, alternatively

sudo chown -R MyUser .

That should allow you to do most operations, no need for any further modifications.


If you want to specifically have write permissions to all files and folders if they have been removed otherwise:

sudo chmod -R u+w .

And if you're really crazy and just want to give all permissions to everyone (as indicated by your title):

sudo chmod -R 777 .

But this shouldn't be necessary in most cases. Also, do note though that volumes with FAT32 file systems don't have that permissions concept.

In general, changing permissions like this on an external drive shouldn't be the solution to all of your problems though. Rather change the permissions based on a specific problem you face, for that particular folder only.

6
  • 2
    I should remember the command sudo chown -R $(whoami), have to look it up every time
    – Luca Steeb
    Aug 28, 2015 at 13:37
  • 2
    Be careful of the dot after chmod. Never ever ever run sudo chmod -R 777 / you will ruin everything
    – CoderBC
    Sep 7, 2018 at 9:20
  • What the heck? even with sudo I cannot change owner, permissions, or remove a system folder!
    – MilkyTech
    Mar 26, 2020 at 0:55
  • 1
    @ChrisM Is this on a new macOS release? Could be support.apple.com/en-us/HT204899
    – slhck
    Mar 26, 2020 at 8:49
  • Yes, Catalina. I found the solution on Reddit. Disable SIP in Recovery Mode, then boot into Catalina and input into terminal sudo mount -uw / This allowed me the "permissions" I needed to delete the folders. This only lasts until reboot. You then have to go back to recovery mode to reenable SIP.
    – MilkyTech
    Mar 26, 2020 at 16:46
0

You can do this with Terminal, but there's a simple way right from Finder.

Click on the drive in question [this works for any non-boot drive] & Cmd ⌘ i or right click > Get Info.

Click the padlock, bottom right & enter your admin password, then check the box marked 'Ignore ownership on this volume'.
Done.

enter image description here

You must log in to answer this question.

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