👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.

On Linux, how to give user permission to write to a folder?

To give user permission to write to a folder, you have two options:


Change the owner of the folder


The command chown (change owner) allows to change the user and/or group ownership of each given file or folder.


The following example set rights to the group www-data on folder /path/to/folder/ and subdirectories :

chown -R username /path/to/folder/

The -R option (Recursive) apply the command to files and directories recursively.



Change folder permission


The command chmod (change mod) change the access permissions of files or directories:

sudo chmod -R 777 /path/to/folder/

In the previous example, 777 gives Read / Write / Execute access to to all users. Change this parameter according to your needs.

The -R option (Recursive) apply the command to files and directories recursively.







More