set folder owner group

415 views Asked by At

I have application running on ubuntu 12.04 and when user submit file using submit form I got permission denied error. So it seems that user don't have permission to write. when I'm logged in as root and use ls -l folder_name it write

drwxrwxr-x   2 root root  4096 Dec  5 01:17 folder1
drwxrwxr-x   2 root root  4096 Dec  5 01:17 folder2

when I use chown myuser folder_name and repeat ls -l folder_name it gives me the same output so myuser is still not owner of the folders. How can I add myuser as owner of existing folders and all newly created folders inside existing folders. `

1

There are 1 answers

1
robm On BEST ANSWER

Several things to consider-

  • owner is root so either 'sudo chown' or become root to do the change
  • chown myuser:mygroup to change both the owner and group (or chgrp)
  • from your question it sounds like this is from a web page, so it will probably need to be owned by apache:apache or whatever your webserver runs as
  • you can't specify the owner of all newly (future) created folders inside these, just who has permissions (chmod) to create folders and then depends on what user is trying to do the creates.

the command is:

sudo chown -R apache:apache folder1