Score:0

Folder created in terminal does not give access to control panel user

in flag

I have made a script which creates a folder (website) in the public path of a website that belongs to a website control panel (CyberPanel):

mkdir /home/example.com/website/

But this command does not give enough permissions to the panel user to create or edit files inside it, the permissions are:

ls -la /home/example.com/website/

total 8
drwxr-xr-x 2 root      root    4096 Dec 14 11:49 .
drwxr-xr-x 4 softs4939 nogroup 4096 Dec 14 11:49 ..

when I create a folder in the panel, I get the permissions:

ls -la /home/example.com/website/

total 8
drwxr-xr-x 2 softs4939 softs4939 4096 Dec 14 11:48 .
drwxr-xr-x 4 softs4939 nogroup   4096 Dec 14 11:49 ..

which lets the panel user to edit anything in it.

How do I make the folder and all its file inside it (made in terminal) to be editable by panel user?

Paul avatar
cn flag
Have you installed cPanel to your server?
Computer User avatar
in flag
I am using CyberPanel with OpenLightSpeed
Score:2
in flag

Three options:

  1. Run the command as the target user, not as root.

    sudo -u softs4939 mkdir /home/example.com/website/
    
  2. run chown afterwards

    mkdir /home/example.com/website/
    chown softs4939:softs4939 /home/example.com/website/
    
  3. use install

    install -o softs4939 -g softs4939 -d /home/example.com/website/
    

Personally, I prefer option 3 in such scripts.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.