chmod unable to change permissions
I copied the file to my ~/.ssh
folder and then changed the permissions with chmod
. That did it.
Just to provide more information, the permissions for the ssh folder,
drwx------ 8 roh21 108 272 Jun 26 17:26 .ssh
And the permissions to the folder I used initially
drwxrwxrwx 2 roh21 108 2048 Jun 23 06:32 startup
I curious as to why I could not change the permissions to the startup
folder even after multiple attempts with the chmod -R
option.
Also, note that I was using Mac OS X in my school's library.
Probably not related to initial questions problem, but can be useful. (especially to Unix novices like myself)
Chmod will not work if you are not an owner of resources.
You should run chown first:
$ sudo chown -R $(whoami) .
and then
$ sudo chmod -R +rwX .
First command will change owner of everything in current folder to be logged in user, and second give them read write execute permissions. Just for example, you, probably, should not change ownership and permissions so boldly.
Looks like you've discovered that the Macintosh doesn't strictly agree with the UNIX permission bits.
Ultimately, there are ACL bits that MacOS sets and that the Macintosh Finder obeys.
To solve your problem quickly, in your Terminal command line, type in "open .
" (or the path to your "startup
" folder) and that will open up the folder in your Macintosh Finder.
Then do a "Get Info" on the file:
You can change your permissions here.
See that '@' next to the mode flags? That means that there's extended metadata associated with the file. Use ls -l@
to see it. The xattr
command will let you view and modify them. It's possible that there's something there that prevents you from modifying the file.
There may also be additional file flags. Use ls -lO
(capital-O) to view those. Odds are that one of those flags is the "uchg" flag which means your file is immutable. You can remove that with chflags nouchg <filename>
as أحمد طه suggested.
Finally, there might be an ACL attached to the file. Use ls -le
to see that.
In general, if you really want to know all the metadata associated with a file on a Mac, the command is ls -leO@
.