Hello,
Although I m successfully able to view and download the files from server, I cant upload the files on server (and replace the default ngineX page).
FileZilla Throws an error /usr/share/nginx/html/index.html: open for write: permission denied
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!
This question was answered by @jtittle:
@prashantsani - What are the current permissions set to for each directory (i.e. /usr, /usr/share, /usr/share/nginx and /usr/share/nginx/html)? You’ll need to ensure that the user & group has permission to read & write. Ideally, for directories, that’ll be 0755 – for files, 0644.
While logged in to your Droplet, you can use
ls -alto view permissions for each directory and file in the current directory. The permissions column will be the first on the left. Looking at each line, you’ll either see ador-as the first setting indicating whether the listed item is a directory or file.The next nine
-'s will be set asr,w,xor-(read, write, execute or empty). The first three will be for User, the next three for Group and the final for Other (i.e. world).If a directory has the permissions set
drwxr-xr-x, that translates to 0755. The user has read, write and execute permissions and group + other have read and execute permissions (but not write).If a file has the permission set
-rw-r--r--, that translates to 0644. The user has read and write permissions and group + other have only read permissions.To be able to modify a file (which includes overwriting it via S/FTP), you’ll need at least read & write permissions and need to be logged in as the user given the permissions. The exception to this is, of course, the
rootuser, asrootshould be able to read, write and execute regardless of the permissions set for other users.That said, to change permissions using the CLI, you can simply use the
chmodcommand followed by octal permission value (i.e. 0755 or 0644) and finally the file or directory.
chmod 0644 filename.php
chmod 0755 /path/to/directoryYou can also recursively CHMOD using the
-roption, though you’ll want to be careful that you limit the CHMOD to a specific type (file or directory), otherwise you’ll end up setting all directories and files in a path to a CHMOD that may be too restrictive or too open (as-rwill apply the changes to current directory + all sub-directories).To do a recursive CHMOD on all files of a certain type:
find /path/to/dir -type f -print0 | xargs -0 chmod 0644To do a recursive CHMOD on all directories in a path:
find /path/to/dir -type d -print0 | xargs -0 chmod 0755Simply replace
/path/to/dirwith the path of your choice – in this case, if you wanted to target the files in the directory you mentioned above:For files:
find /usr/share/nginx/html -type f -print0 | xargs -0 chmod 0644For directories:
find /usr/share/nginx/html -type d -print0 | xargs -0 chmod 0755
this is such a stupid answer considering that you can just add the user to the group www-data
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.