S
i want to increase the security of SSH
service of our machine that is configured by default, we will do is change some options for extra safety
file / etc / ssh / sshd_config
sudo cp / etc / ssh / sshd_config / etc / ssh / sudo chmod sshd_config.original a-w / etc / ssh / sshd_config.original Once copied to a new file and write-protected can not change it, proceed to its amendment: 1. Assigned to the service port (22) as change by 5301. We sought
line "Port 22"and instead write
"Port 5301"
2. We set the maximum number of failed login attempts to 1. If you do not have it yet, add the line .
"MaxAuthTries 1"
.
3. Indicate that the maximum number of concurrent unauthenticated connections are 2 with the following line "MaxStartups 2" .
4. Establish the direction of listening to our Private IP:"ListenAdrress 192.168.2.100 (IP machine)"
.
5. Indicate which users can connect and from which IP:"AllowUsers usuario@192.168.0.11"
6. We must also realize that probably, when administrators need to connect from any machine regardless of whether it is in our network or not, we must add a user for that purpose:
"user2 user3 user AllowUsers"
.
7. Finally, we disable the option to connect as root, to prevent external intrusion attempts, the line editing"PermitRootLogin no"
.
If we complete even more security, you can set the permission of the host to attempt to connect to the service. For this we make the following changes:1. In file / etc / hosts.deny
add the following line:"ALL: ALL"
.
2.edit the file / etc / hosts.allow and add the host
those who allow access. In this case we will do only a single computer.
"sshd: 192.168.0.104 (IP notebook)".
After saving the changes, we restart the service to take effect:
sudo / etc / init.d / ssh restart
0 comments:
Post a Comment