How to secure a Ubuntu Server (part 1)

Published: 23 November 2021
on channel: Telifox
313
4

How to secure a Ubuntu Server (part 1)

Ubuntu Security Documentation
https://ubuntu.com/server/docs/securi...

0:00 - Intro
0:27 - Creating new local accounts, adding new profile photographs, Removing Users

4:20 - Securing their home folders

Remove the world readable-permissions using the following syntax:
sudo chmod 0750 /home/username

6:21 - A much more efficient approach to the matter would be to modify the adduser global default permissions when creating user home folders. Simply edit the file /etc/adduser.conf and modify the DIR_MODE variable to something appropriate, so that all new home directories will receive the correct permissions.

sudo nano /etc/adduser.conf
DIR_MODE=0750

8:23 - Firewall Configuration and GUI firewall - Adding new programs to favorites
sudo apt install gufw

11:00 - Creating new password policies
sudo nano /etc/pam.d/common-password

If you would like to adjust the minimum length to 8 characters, change the appropriate variable to min=8. The modification is outlined below.
password [success=1 default=ignore] pam_unix.so obscure sha512 minlen=8

12:20 - Password Expiration
When creating user accounts, you should make it a policy to have a minimum and maximum password age forcing users to change their passwords when they expire.
To easily view the current status of a user account, use the following syntax:

sudo chage -l username

sudo chage -E 01/01/2021 -m 5 -M 90 -I 30 -W 14 username

This is an example of how you can manually change the explicit expiration date (-E) to 01/31/2015, minimum password age (-m) of 5 days, maximum password age (-M) of 90 days, inactivity period (-I) of 30 days after password expiration, and a warning time period (-W) of 14 days before password expiration.

16:57 - Adding new groups and Adding a user to a group (SSH group)
sudo groupadd -g 10000 groupname

sudo adduser username groupname

18:00 - Install openssh-server
sudo apt-get install openssh-server
Select "Install the package maintainer version"

19:00 - Configuring the SSH file to accept only specific users

sudo nano /etc/ssh/sshd_config
Add the following:
AllowGroups sshlogin
ctrl+X and the y and enter to save file

Restart server
sudo systemctl restart sshd.service

20:15 - App Armor server install and configuration
sudo apt install apparmor-profiles

View Status
apparmor_status is used to view the current status of AppArmor profiles.
sudo apparmor_status

Install Armor utilities
sudo apt-get install apparmor-utils

New Profiles
sudo aa-genprof executable

25:00 - Firewall Logging

sudo ufw logging on
view log in /var/log/ufw.log

27:40 - Console security
To disable the reboot action taken by pressing the Ctrl+Alt+Delete key combination, run the following two commands:

sudo systemctl mask ctrl-alt-del.target
sudo systemctl daemon-reload


On this page of the site you can watch the video online How to secure a Ubuntu Server (part 1) with a duration of hours minute second in good quality, which was uploaded by the user Telifox 23 November 2021, share the link with friends and acquaintances, this video has already been watched 313 times on youtube and it was liked by 4 viewers. Enjoy your viewing!