202k views
1 vote
During a random security audit, you found that ownership and group ownership for the /hr directory is set to Will Adams (wadams). For security reasons, you need to change the ownership. You want to give ownership to Brenda Cassini (bcassini), the office manager, and you want to give group ownership to the hr group for all the files in the directory. After you do this, you need to reset group ownership on the /hr/personnel file to mgmt1.

In this lab, your task is to:

Give bcassini ownership of the /hr directory and all of its contents.

Give hr group ownership of the /hr directory and all of its contents.

Return group ownership of the /hr/personnel file to mgmt1.

User Rey Ramos
by
8.0k points

1 Answer

3 votes

Final answer:

To change ownership of the /hr directory to user bcassini and group hr, use the chown command. To then change the group ownership of the /hr/personnel file to mgmt1, use the chgrp command.

Step-by-step explanation:

During a security audit, if you find that the ownership of the /hr directory is incorrect, you can change it using Linux command-line tools. To give Brenda Cassini (bcassini) ownership of the /hr directory and all of its contents, you would use the chown command recursively:

sudo chown -R bcassini /hr

Next, to give the hr group ownership of the same directory and all of its contents, the chgrp command or the chown command can again be used recursively:

sudo chown -R :hr /hr

or

sudo chgrp -R hr /hr

Finally, to return group ownership of the /hr/personnel file to mgmt1, without changing the owner, you would use the chgrp command:

sudo chgrp mgmt1 /hr/personnel

To give ownership of the /hr directory and all of its contents to Brenda Cassini (bcassini), you can use the chown command with the -R option to recursively change the ownership:

chown -R bcassini /hr

To give group ownership to the hr group, you can use the chgrp command with the -R option:

chgrp -R hr /hr

To reset the group ownership on the /hr/personnel file to mgmt1, you can use the chgrp command:

chgrp mgmt1 /hr/personnel

User Vyacheslav
by
8.1k points