CHMOD files was created by root

  • Posted on June 11, 2014
  • sw2015Asked by sw2015

Hello, I’m New DigitalOcean user, I creat a new Droplets (Ubuntu 14.04)and I install VestaCP to control web sites. the Problem is:- when I get files by ssh as “root”(Ex. Wordpress.tar.gz) and put it inside (public_html) in any sites and extract it as root the files&folders from (Wordpress.tar.gz) get CHMOD (nobody- nogroup) and web site’s admin can’t edit or create folders inside this folder. and my public_html is in: /home/admin1/web/user1/public_html not like /home/user1/public_html

admin1: which is creat by VestaCP as a user (for creating websites and Data) user1: which is creat by VestaCP as a website

Any solution ?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

The command you list are correct for changing ownership of files that you’ve already created. In the future, however, you should use the “user1” account whenever you are working on the site to ensure you don’t have any future problems. There are two reasons for this:

  1. Depending on your configuration Vesta may use suexec to run scripts. for security purposes, suexec will not allow a script to run if it is owned by a user that is not the one running the process. Since all scripts run under the user that the site is assigned to, files owned by root in the public_html directory will not work if your server is configured this way.
  2. As a general rule, you should only use root when you need it. Root is all powerful, so it can be really easy to accidently do things you don’t mean to do, like deleting important files because you aren’t in the directory you thought you were. Working as “user1” is safer because you won’t be able to don anything that effects the entire server or the files owned by any other user.

I’m now using this commands : <pre> sudo chown -Rv username directory sudo chown -v username file </pre> to give the user permission,but I think that isn’t general solution !