Open for write: permission denied

New Page


FTP open for writing: permission denied

  • Posted on January 2, 2015
  • TedinozAsked by Tedinoz

Hello, I am new to linux. I followed very helpful online tutorials to configure CentosOS 6.5 and successfully installed LAMP, SSH and vsftp server.

I setup a second user with the same privileges as root and I can access the droplet via FTP (using FileZilla) as a new user and I successfully uploaded a file but **I can’t upload any files , nor a new file or a new file modified version of an existing file. I tried a simple upload to “/var/www/html” where owner=root and group=root.

The error message is: Error: /var/www/html/index.php: open for writing: permission denied Error: file transfer failed

I’m sure it’s something simple; All help gratefully received.


add a comment

See accepted answer


show comments

Submit an answer

By default, this text box uses Markdown to format your response.

You can type !ref in this text box to quickly find our full set of tutorials, documentation, and market offerings and insert the link.

Log in or register to reply

Ces réponses sont fournies par notre Communauté. Si vous les trouvez utiles, montrez un peu d’amour en cliquant sur le cœur. Si vous rencontrez des problèmes, veuillez laisser un commentaire ou ajouter votre propre réponse pour aider les autres.


Andrew S.B. • 6 janvier 2015

réponse acceptée

L’octroi des privilèges sudo à l’utilisateur vous permettra d’exécuter des commandes en tant que root, mais n’affectera pas les fichiers auxquels vous pouvez accéder via FTP. FTP ne s’intéresse qu’à l’utilisateur/groupe propriétaire du fichier.

Typically, the Apache web root on a CentOS server is owned by the Apache user, not the root user. Adding the user to the apache group and granting write ACLs on the folder should allow you to access files in that directory via FTP.

chown -R apache:apache /var/www/html/ sudo usermod -a -G ted apache sudo setfacl -R -mu:ted:rwx /var/www/html

  • Show answers
  • Answer

cloud travel

You want to know more ? Join the Digital Ocean community!

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

Register now


DigitalKrate February 11, 2018

If anyone is using Ubuntu, I used the following to solve my problem thanks to @asb for pointing me in the right direction:

sudo usermod -a -G YOUR_USERNAME www-data sudo setfacl -R -mu:YOUR_USERNAME:rwx /var/www/html

Hope this can help others. Thanks again to @asb

  • Show answers
  • Answer


Phoenix21 • July 26, 2018

Thanks @Infused who solved my problems. However, every time I create a new file on my server, I have to do this, surely there is a better way.

It gets really annoying having to do this every time haha

  • Answer

raffaelesicuriello • April 7, 2020

hello i tried the command

sudo usermod -a -G YOUR_USERNAME www-data sudo setfacl -R -mu:YOUR_USERNAME:rwx /var/www/html

but now I only access via ftp and can’t access via web or network folder anymore. How can I solve it?

  • Answer

load more answers

  1. CircleCI Support Center
  2. Using CircleCI
  3. building projects

Permission denied while creating directory or writing file



July 28, 2022 9:34 p.m.



Estimated reading time: 1 minute
Estimated reading time: 1 minute


If you get an error that you don’t have permissions to create a directory or to write a file to a directory, it probably indicates that your script is trying to write to a directory that you don’t own. 

This is a somewhat common pitfall that many users encounter when moving to a CI environment. 

Builds are run as distilleruser on MacOS, and usually ubunutu on Linux. These users only have $HOME write permissions to their folders and locations like /tmp. This is not unique to CI and is true by default in almost all Linux/Unix environments.

To confirm that the user running your build has the correct permissions, you can run the whoami command in your build process. The solution

There are several possible solutions to this problem:

  1. Create a folder that the user running the build has permissions to.
  2. Change ownership of the directory with the chown command before attempting to write to it.

We recommend the first solution. If you decide to go with the second solution, a command like this should work on both macOS and Linux versions.

chown -R $USER:$USER /path/to/directory

$USER is a global environment variable that refers to the currently logged in user.

/path/to/directory should be replaced with the path you want to write to.

Did you find this article useful


123 out of 570 found this helpful

If you need more help, please create a support ticket here.


0 comment

The article is closed to comments.

Articles in this section

  • How to install npm on windows images
  • How to configure jEnv in CircleCI with $BASH_ENV
  • How to fix “The following signatures could not be verified because the public key is not available” when building a docker image
  • Intermittent checkout step failure
  • How to retry a step that intermittently fails
  • Error Received: This task has been claimed, but has not received a heartbeat for more than 5 minutes
  • Runner Support for CircleCI IP Ranges
  • Automatically cancel construction after a certain time
  • Context exceeded deadline after one hour: Compilation timed out (free version only)
  • Build fails due to SSH handshake

See more

Video Open for write: permission denied

Related Posts

Free chat room code for my website

Contents1 How to set up a free chat room on the website.2 3 comentarios2.1 Trackbacks/Pingbacks2.2 Submit a Comment Cancel reply3 How to Create a Chat Room Website…

Background image full screen css

Contents1 Cómo – Full Page Image1.1 Example1.2 Example2 CSS background image tamaño tutorial: how to codify a complete page background image3 Perfect Full Page Background Image3.1 Méthode CSS géniale,…

WordPress leverage browser caching

Contents1 Aproveche el almacenamiento in hidden del navegador1.1 Will it works for my website?1.2 Where are plugin options1.3 Some JavaScript files still display under Leverage Browser Caching1.4…

WordPress post to facebook page

Contents1 How to Automatically Post to Facebook from WordPress1.1 Download Now: How to Launch a WordPress Website [Free Guide + Checklist]1.2 1. Create an IFTTT account.1.3 2….

Download images from wordpress media library

Contents1 How to export your WordPress media library1.1 Download maintenant : How to launch a WordPress website [Free Guide + Checklist]1.2 How to export your WordPress media…

WordPress single post template

Contents1 How to Create Custom Unique Post Templates in WordPress2 Post Template Files2.1 author.php2.2 Fecha.php3 Handbook navigation4 How to Create Custom Single Post Templates in WordPress5 Video…