MacOS – I can’t write to a file that I own on /Users/shared

macospermissionsharing

I am running macos Sierra 10.12.1

It's a plain text file. I've put rw permission on it for all users, but the only way that I can write to it is by having an account with admin privileges use sudo to edit it. It claims to be 'locked' in TextEdit, and I don't have the permission to unlock it.

Here is it ls -l@ entry:

-rw-rw-rw-@ 1 thelma  staff  15424 Oct 28 12:47 addresses
    com.apple.metadata:_kTimeMachineNewestSnapshot     50 
    com.apple.metadata:_kTimeMachineOldestSnapshot     50 

Best Answer

A "Locked" file is a different situation than file permissions and who owns it and can write to it. It's actually locked for everyone including the owner.

This will require admin privileges

  1. Go to finder
  2. locate the file.
  3. select it and right click then choose "get info" or cmd+i (with it selected)
  4. Uncheck the "locked" option.

If this isn't the actual issue then permissions are wrong and need changed.

EDIT: Apologies for the delay in editing! Been rather busy!

tldr; Perhaps you are not a member of the group associate with the file.

I tested this with a file myself. I navigated into /Users/Shared (Capital S for shared, this is wrong in your question heading, just to ensure correct directory), and then made a file with:

touch test-file-permissions

This created a file named test-file-permissions with group assess of wheel, and administrator group. This was the outcome:

-rw-r--r--  1 MyCurrentUserName wheel  0 Nov  3 19:00 test-permissions

From here I was able to both use Nano, a terminal editor to edit the file and sublime text without sudo(GUI and terminal editors can make a difference for example: when editing the /etc/sudoers file it must be done by a terminal editor and command visudo).

I then changed the file permissions for group ownership and permissions with editing writes still in my abilities and no problems.

Note: We have two commands here. chmod and chown.

chown -- change file owner and group

AND

chmod -- change file modes or Access Control Lists

Using chmod I tested personal rights to the file without group permissions, and then even changed which groups had ownership with no problems with requiring sudo to change the file. I didn't need it, simply put.

Note: TheGroupNameIChangedTo is a group on my machine. I, the user account, must be a member of this group, in which case I am.

Don't know your groups? Run command: groups

Moving on..

chown MyUserName:TheGroupNameIChangedTo test-permissions
chmod -v 0660 test-permissions

Outcome:

-rw-rw---- 1 MyUserName TheGroupNameIChangedTo  27 Nov  3 19:11 test-permissions

Therefore I believe your group may not be correct on the file. Your two user accounts, Admin and Standard must be a member of the same group. A solution would be to create one named whatever you like that doesn't conflict with existing, and add both users to it DO NOT ADD STANDARD USER TO WHEEL GROUP FOR SECURITY PURPOSES, ALTHOUGH THIS WILL SOLVE IT IN A WAY, IT POSSES A RISK .. I emphasize this because I understand and actually applaud with your two account system here separating Admin and Standard users. This is very smart!

Update me if this is what you want/needed, I'll keep peeking in on the question. My answer may be a bit out of the way, but I wanted to cover everything for you and others viewing the question. I'm open to edits from viewers. All else aside, it'll still get edited later for clarity.