Skip to content

Install and configure SSH server to be safer.

Good night,

To install ssh server in Ubuntu use:

$ sudo apt-get install openssh-server

To let it safer edit /etc/ssh/sshd_config

$ sudo vi /etc/ssh/sshd_config

Than change the lines:

AllowUsers USER
AllowGroups GROUP_USER
PasswordAuthentication yes
MaxStartups 2:100:2
Port XXX # Change the port

What MaxStartups do? Specify the number of un authenticated connections in server. The syntax is start:percent:max. Example: 10:50:20. When it gets to 10 connections it will start with the percent. So every new connection will have 50% of chance to be automaticlly refused. When it gets to 20. It will denied ALL the new connections.

If you want, you can ask for a second password, if you type it wrong, it will close the connection:

Edit /home/user/.profile

echo Put your password
read senha
if [ $senha == “SOMETHING” ]
then
# CODES THAT ALREADY ARE AT .profile
else
exit
fi

With this you can do some tricks, to create a new RANDOM password every time somebody connect and send it to your e-mail. So you will need to put your normal password, than access your e-mail account, verify the new password and type it.

Best Regards,
Matheus

References:
Desabilitar Comando SU
Informação MaxStartups

Published inLinuxShell Script

75 Comments

  1. натяжные потолки от производителя в самаре [url=natyazhnye-potolki-samara-2.ru]натяжные потолки от производителя в самаре[/url] .

  2. натяжные потолки от производителя в самаре [url=https://natyazhnye-potolki-samara-2.ru/]натяжные потолки от производителя в самаре[/url] .

  3. заказать кухню по индивидуальным размерам в спб [url=http://kuhni-spb-3.ru]http://kuhni-spb-3.ru[/url] .

  4. прямые кухни на заказ от производителя [url=https://www.kuhni-spb-3.ru]https://www.kuhni-spb-3.ru[/url] .

Leave a Reply

Your email address will not be published. Required fields are marked *