Restrict access to a web page
Rex is a RHEL Sysdamin at Djere Services Group. Djere_RHEL_Server_01 hosts the Djere website: https://djere.com/. There are several groups on the server:
- admins
- web_designers
- web_developers
- authors
- front_end_engineers
Rex wants to set it so that all groups have read access to djere.com, but web_developers only have read-write access once they authenticate with the password "1465865_pass_293404#@!". How is Rex going to set this up?
To achieve the desired access control setup on Djere_RHEL_Server_01, Rex can follow these steps:
- Grant read access to all groups: First, Rex needs to ensure that all groups have read access to the Djere website. He can set the appropriate file permissions using the following command:
- sudo chmod -R g+r /path/to/djere.com/
This command recursively grants read access (
g+r
) to all files and directories within the/path/to/djere.com/
directory.
- Create a separate directory for web_developers: Rex can create a specific directory where web_developers will have read-write access once they authenticate. For example:
- sudo mkdir /path/to/djere.com/web_developers
- Set read-only access for web_developers initially: Rex can restrict web_developers' access to read-only by changing the file permissions on the
web_developers
directory:- sudo chmod -R 550 /path/to/djere.com/web_developers
- This command sets read and execute permissions for the owner (Rex), and no permissions for the group (web_developers) and others.
- Set password authentication for write access: Rex can enable password authentication specifically for the
web_developers
group on theweb_developers
directory. He can accomplish this by creating an.htaccess
file and configuring it to require a password:- sudo htpasswd -c /path/to/djere.com/web_developers/.htpasswd web_developers
- This command creates an
.htpasswd
file and adds theweb_developers
group with the password "1465865_pass_293404#@!".
- Grant write access to authenticated web_developers: Finally, Rex needs to modify the file permissions to allow write access to the
web_developers
group when they authenticate with the correct password:- sudo chmod -R 570 /path/to/djere.com/web_developers
- This command grants read, write, and execute permissions to the owner (Rex), read and execute permissions to the group (web_developers), and no permissions for others.
By following these steps, Rex can ensure that all groups have read access to the Djere website, while web_developers can obtain read-write access by authenticating with the specified password.