Question #31

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

Answer

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.







4 events in history
Answer by Alphonsio 10/10/2020 at 03:49:32 AM

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.







Answer by Alphonsio 10/10/2020 at 03:24:33 AM

The command chown 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 filename.txt:


chown www-data filename.txt



Question by Alphonsio 05/05/2020 at 10:53:46 AM
On Linux, how to give user permission to write to a folder?
Answer by Alphonsio 05/05/2020 at 10:52:54 AM

The command chown 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:

chown www-data filename.txt



# ID Query URL Count

Icons proudly provided by Friconix.