Chown not working

Corbz picture Corbz · Feb 19, 2013 · Viewed 52k times · Source

On Ubuntu 12.04, the chown command doesn't seem to be working like it should

root@server:/var/www/folder/# ls -al

Running this puts out

drwxr-xr-x 11 776 sftponly 4096 Feb 17 14:08 Other_Folder

I need write permissions for the group, so I run:

chown -R 776 ./Other_Folder

Then when I run ls -al again, the output is still

drwxr-xr-x 11 776 sftponly 4096 Feb 17 14:08 Other_Folder

Answer

Nick Pickering picture Nick Pickering · Feb 19, 2013

chown is used to change ownership of the file, not change permissions.

ls -al is not showing you who owns the file, just its permissions.

If root owns those files, you'll need to chown them properly, before you can change their permissions:

chown -R yourname:yourname folderName

Then as the owner you can change their permissions:

chmod -R 776 folderName

Edit: I double checked the syntax and it seems to be right, you'll likely need to use sudo to use them.