Linux: How to change folder ownership

binarysoulbinarysoul Member Posts: 993
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 icon_sad.gif

Comments

  • ehndeehnde Member Posts: 1,103
    Try 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.
  • EssendonEssendon Member Posts: 4,546 ■■■■■■■■■■
    Everyone wrote: »
    man chown

    WTF was that?! Is that a real Linux command?

    P.S. I am completely ignorant about Linux
    NSX, NSX, more NSX..

    Blog >> http://virtual10.com
  • powerfoolpowerfool Member Posts: 1,666 ■■■■■■■■□□
    Essendon wrote: »
    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 man
    2024 Renew: [ ] AZ-204 [ ] AZ-305 [ ] AZ-400 [ ] AZ-500 [ ] Vault Assoc.
    2024 New: [X] AWS SAP [ ] CKA [ ] Terraform Auth/Ops Pro
  • EveryoneEveryone Member Posts: 1,661
    powerfool wrote: »
    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 man

    icon_lol.gif That always makes me giggle.

    You have to check this out if you've never seen it... guest@xkcd
    Type "man cat" in there. icon_thumright.gif
  • tierstentiersten Member Posts: 4,505
    ehnde wrote: »
    Try 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.
    You can change the username and group together instead of doing chown then chgrp. Only do it on directories that need it.
    "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.
Sign In or Register to comment.