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.
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.
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
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 |
---|