Configure the system so that all newly created users have their passwords expire after 90 days.
Ensure that every new user created on the system automatically has a file named newfile located in their home directory upon creation.
Create a user named alex. Assign a password of redhat.
Verify that alex's password aging is correct (Can't refer to /etc/shadow ) and the file exists in their home directory.
Solution
Edit password expiry after 90 days
sudo vim /etc/login.defs
Esc --> I
Change PASS_MAX_DAYS value from to 90
Esc --> :wq --> Enter
Automatically create newfile
sudo touch /etc/skel/newfile
Create user
sudo useradd alex
sudo passwd alex
Verify
sudo chage -l alex
sudo ls /home/alex
Create a user named manager.
Configure manager so they can execute the useradd, userdel, and usermod commands using sudo without being prompted for a password.
Ensure that manager is strictly prohibited from changing the password of the root user via sudo.
Configure the system so that once any user authenticates with sudo, their session remains authenticated across all terminals for 60 minutes.
Solution
Create user
sudo useradd manager
sudo passwd manager
Grant sudo access
sudo vim /etc/sudoers.d/manager
Esc --> I
manager ALL=(ALL) NOPASSWD: /usr/sbin/useradd, /usr/sbin/userdel, /usr/sbin/usermod, /usr/bin/passwd, ! /usr/bin/passwd root
Esc --> :wq --> Enter
60 minutes authentication
sudo visudo
Esc --> I
Defaults timestamp_type=global,timestamp_timeout=60
Esc --> :wq --> Enter
Verify
su - manager
sudo useradd newuser
cat /etc/passwd
Create a group named devops.
Create two users, susan and mick.
Configure susan and mick so that devops is their secondary group (supplementary group).
Lock the account for mick so that he cannot log in to the system.
Verify using the id command that both users belong to the correct groups.
Solution
Create group
sudo groupadd devops
Create users
sudo useradd susan
sudo useradd mick
sudo passwd susan
sudo passwd mick
Add user to group
sudo usermod -aG devops susan
sudo usermod -aG devops mick
Lock mick account
sudo usermod -L mick
Verify
sudo passwd -S mick
id susan
id mick
Identify the IP address of your current station.
Ensure the sshd service is currently running and enabled (so it starts automatically on boot).
From a remote terminal, log in as the user student.
Create a directory named remote_test in the home directory of student via the remote session, then exit.
Solution
Identify IP address
ip a
inet 192.168.0.110
Enable the sshd service
sudo systemctl enable --now sshd
Check sshd service
sudo systemctl status sshd
Remote login from Windows
ssh student@192.168.0.110
Create directory
mkdir ~/remote_test
Exit
exit
Verify in RHEL
ls ~