Linux Security - PART 1
sathishkumar balachandran
Posted on July 22, 2023
We are going to discuss on below Topics :
- Linux Security Problems
- Local Filesystem Security
- Local Authentication in Linux
- Remote Auhentication
- Network Security
- Security Tools & Distros
- Patching a Bash Vulnerability
- Security Monitoring & Logging
1. Linux Security Problems
Important Points to be remembered :
- Remove unnecessary packages.
- After any installation work on security aspects.
- Always remember : Accessibility , Software Installation Rights , Data permission and Recovery from Failure
- Password Protection Policy
- Integrity Checks : MD5 checksum - This will provide hash value which can be checked for any issues. To use this , there is also a package : sudo apt-get install gtkhash
How to check user as ROOT access ?
useradd Linux
passwd Linux
usermod -aG sudo testing
su testing
groups
sudo whoami
Once its populating 'root' at the last , this user as ROOT access.
NMAP :
- Scan a network.
- Gather information about a network.
- https://nmap.org/
- This can check what ports are running , status , etc.
2. Local Filesystem Security
- ls
- ls -FC ( directories will have '/' at the end , executables will have '@' at the last , etc )
- ls -l
- ls -a ( hidden files )
- ls -lh ( size )
- ls -d */
- ls -lah ( always use to practice this ! )
chmod :
u - user/owner
g - group
o - Others
r - Read
w - write
x - Execute
Adding the permission ,
chmod u+x file_name
chmod g+x,o+x file_name
chmod o-x file_name ( remove the permission )
chmod a+r file_name ( a - for all users , it will provide read permission for all users like u,g,o )
chmod a-r file_name
chmod o+x -R ( R for recessive for a directory )
we can also reference one file permission to other ,
chmod --reference=file1 file2
Now OCTAL representation ,
r = 4
w = 2
x = 1
Read and Execute Permission,
r-x = 4+0+1 = 5
rwx = 4+2+1 = 7
r-- = 4+0+0 = 4
chmod 754
Access Control List :
- ACL
- Check whether ACL is installed or NOT , check using any file : getfacl file_name
Here user3 won't have access to the directory.
We can save the permission of a directory for future purpose,
getfacl -R /directory>permissions.acl
We can also restore the permission,
setfacl --restore=permission.cal
move command :
- mv file_name /directory ( files will be deleted in the old directory )
- Rename file and directory can be done with this.
- mv -V *.txt /directory ( like Verbose )
- mv -i file_name /directory ( it helps to notify if there is any same file_name in the target directory , it will give a pop up )
- mv -uv *.txt /target (TBD) Its like updating the file.
- mv -bv *.txt /target (TBD) it will create backup file
- mv -nv *.txt /target (TBD)
Notes :
- usermod -aG (TBD)
- what is the difference between useradd or adduser ? (TBD)
- passwd -d username (TBD)
- Add the user to the group , usermod -G group1 user1
- Add group , addgroup group1
Posted on July 22, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.