• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Tutorial to secure Plesk on Linux Server

Sysmonet

New Pleskian
Hi;
As a newbie to VPS and Plesk, I tried to secure my server following the tutorials. But when I started by changing the port in sshd_config, I got connection refused. I reinstalled my VPS, started from zero and each time I get some kind of error. All I want is to sleep comfortably knowing that nobody can brut force access to my server and turn it inaccessible for me. The use of root and showing my IP just by checking DNS and using standard port like 22 for SSH or going IP_Adress:8443 and using admin and brut force password.
Could you help me or showing me how to protect my server?
 
After watching so many tutorials, here is what I did for future searchers :
1- logged in SSH using root provided access
2- Added a new user (adduser username)
3- Entred to : visudo
added my username under root user and gived it all root privelages
username ALL=(ALL:ALL) ALL
4- gived the new user admin sudo
4'- on a debian 8 server I just use : su root
to access root
4"- on Ubuntu 16.04 i run the command : sudo systemctl username sudo
5- I kept the root session opened
6- I opened new session and checked my user access using : sudo /etc/passwd
or : su root
7- using the new session to check my new user privelages I made the following command : sudo apt-get nano
8- Then I copied the sshd_config file :
cp /etc/ssh/sshd_config /etc/ssh/sshd_config_backup
9- check that file exists :
cd /etc/ssh
and
ls
10- modified the sshd_config file :
nano /etc/ssh/sshd_config
10'- Added this under port : AllowUsers username
10"- changed yes to no here : PermitrootAccess no
Then saved CTRL+O, Enter, CTRL+X to save
10'''- in debian server changed the port with no problem, but in the Ubuntu server it doesn't connect (I will update later about this issue)
11- Restarted ssh without closing root session already opened in case it didn't work (learned from mistakes) : sudo restart ssh
Voilà, I could sleep better now. Next I am learning about using keys methods to login, I am just checking what happens if you lost private key.
Hope this helps sombody one day
 
Back
Top