By cleellacer
Im new to linux. I have a root account and a regular account. The droplet is currently in production so i dont want to take the server unintentionally. How do I grant my new non-sudo user to be able to upload files via SFTP to folder structure under /var/website_files
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!
To modify the permissions for a specific directory so that you can write to it, set read/write permissions with the command below
sudo chmod 766 -R /var/www/html
This will assign full permissions 7 for the owner, read/write 6 for the group, and read/write for everyone 6, recursively.
To grant a new user permission to access and manipulate files or folders under the /var/WEBSITE directory, you can modify the ownership and permissions of the directory using various methods depending on your requirements. Below are the most common approaches:
/var/WEBSITE directory and its contents to the new user.Steps:
sudo chown -R username /var/WEBSITE
-R is used to apply the change recursively to all files and directories inside /var/WEBSITE.username with the actual username of the new user.This method grants the new user full ownership of the directory and all its contents.
If you want to allow multiple users (e.g., web developers) to access the directory, you can create a group, assign the user to that group, and change the group ownership of the /var/WEBSITE directory.
Steps:
sudo groupadd webgroup
sudo usermod -aG webgroup username
username with the actual user’s name.-aG option appends the user to the group without removing them from any existing groups.sudo chown -R :webgroup /var/WEBSITE
sudo chmod -R 775 /var/WEBSITE
setgid bit on the directory (optional but recommended): The setgid bit ensures that new files and directories created within /var/WEBSITE inherit the group of the parent directory (webgroup in this case), rather than the user’s primary group.sudo chmod g+s /var/WEBSITE
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.