Linux: How to change folder ownership
binarysoul
Member Posts: 993
in Off-Topic
I'm testing Wordpress on a server and had difficulty uploading images in WP which I figured was due to permission. FTP uploads work fine.
The hosting company emailed saying, "assign ownership as username:apache recursively". Using SSH, I logged in and tried different parameters, it didn't work.
Any idea how can I do this? The last time I worked with Unix was over 7 years ago and forgotten things
The hosting company emailed saying, "assign ownership as username:apache recursively". Using SSH, I logged in and tried different parameters, it didn't work.
Any idea how can I do this? The last time I worked with Unix was over 7 years ago and forgotten things
Comments
-
ehnde Member Posts: 1,103Try this:
chown -R username /path/to/folder
Then you might need to follow up with chmod. I'm not sure of the permissions...be careful if it's internet facing.Climb a mountain, tell no one. -
Essendon Member Posts: 4,546 ■■■■■■■■■■man chown
WTF was that?! Is that a real Linux command?
P.S. I am completely ignorant about Linux -
powerfool Member Posts: 1,666 ■■■■■■■■□□WTF was that?! Is that a real Linux command?
P.S. I am completely ignorant about Linux
Yes... `man` is a command for reading manuals on other commands. Syntax:
man <command>
Actually, if you are on a Linux system and want to learn more about the `man` command, run:
man man2024 Renew: [ ] AZ-204 [ ] AZ-305 [ ] AZ-400 [ ] AZ-500 [ ] Vault Assoc.
2024 New: [X] AWS SAP [ ] CKA [ ] Terraform Auth/Ops Pro -
Everyone Member Posts: 1,661Yes... `man` is a command for reading manuals on other commands. Syntax:
man <command>
Actually, if you are on a Linux system and want to learn more about the `man` command, run:
man man
That always makes me giggle.
You have to check this out if you've never seen it... guest@xkcd
Type "man cat" in there. -
tiersten Member Posts: 4,505Try this:
chown -R username /path/to/folder
Then you might need to follow up with chmod. I'm not sure of the permissions...be careful if it's internet facing.
"chown -R username:apache /path/to/folder"
You'll probably need to allow group access as well so do this as well for the relevant directories that need it.
"chmod -R g+rwx /path/to/folder"
Be aware that this will mean that the webserver has full rights to everything in the directories you change. If there are other sites hosted on that machine then they'll also be able to write to your directories.