Suppose you have given access to a directory to someone to upload and download the files on the server but he’s getting access denied permission. We can change the user owner and group permission with chown command in Linux.
How To Change Owner And Group of Directory In Linux:
Do you know why? Because by default, the root will be the owner and group of that directory. Try the following steps to understand,
Check Out: Create User & Group Using Command line
Step 1: Create a user and group with any name. I have created the user ‘admin’ and group ‘webadmin’.
useradd admin groupadd webadmin
Step 2: I’m assuming, you have given server access to the user by using the ssh PPK key.
As you can see the owner and group are the roots for the data directory.
If you have given access to this directory to the user, So they won’t be able to upload or download the files and do anything.
The solution is you need to change the owner and group of the directory. chown -R admin:webadmin data
Step 3: Now try to upload and download the files here. You won’t get any permission denied.
YouTube Link: Change owner and group
You’re done. change user permissions linux chown group owner