Home Linux How To Change Owner And Group of Directory In Linux

How To Change Owner And Group of Directory In Linux

0
60

How To Change Owner And Group of Directory In Linux

Suppose you have given access of a directory to someone to upload and download the files on the server But he’s getting access denied permission. Do you know why ? Because by default, root will be owner and group of that directory. let’s see how to change owner and group.

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 create user ‘admin’ and group ‘webadmin’.

useradd admin

groupadd webadmin

Step 2 : I’m assuming, you have given server access to user by using ssh ppk key.

mkdir data

As you can see the owner and group is root for data directory.

Check Out : How To Create PPK Key For Login Using SSH In Linux

If you have given access of this directory to 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 welcome.

NO COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

fourteen − 10 =