Week 2: Linux System Administration & Automation
Task 1 : By Shubham Londhe #90daysofdevops
1. Create a user devops_user and add them to a group devops_team
Create a group
Command:
sudo groupadd devops_team
Create a user and assign them to the group
sudo useradd -m -G devops_team devops_user
2. Set a password and grant sudo access.
Command:
sudo passwd devops_user
Grant sudo access to the user
Command:
sudo usermod -aG sudo devops_user
3.Restrict SSH login for certain users in /etc/ssh/sshd_config.
- Edit the SSH configuration file:
command:
sudo nano /etc/ssh/sshd_config
- Add or modify the following lines:
To allow specific users:
Command:
AllowUsers devops_User
Or, to deny specific users:
Command:
DenyUsers <username>
- Save the changes
Press
CTRL + Oto save the file.Press
CTRL + Xto exit the Nano editor.4.Restart the SSH service
To apply the changes, restart the SSH service using this command:
sudo systemctl restart ssh
/
Task 2 : BY Shubham Londhe
File & Directory Permissions
Task:
Create
/devops_workspaceand a fileproject_notes.txt.Set permissions:
- Owner can edit, group can read, others have no access.
Use
ls -lto verify permissions.
Command:
mkdir /devops_workspace
touch /devops_workspace/project_notes.txt
chmod 740 /devops_workspace/project_notes.txt
ls -l