vim ~/.ssh/authorized_keys
cd /home sudo chmod 755 userName cd /home/userName sudo chmod 700 .ssh sudo chmod 600 .ssh/authorized_keys
Port 22 PermitRootLogin no PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys
sudo systemctl restart sshd
ssh -i /home/userName/.ssh/keyName userName@hostname -p 22
PasswordAuthentication no
puttygen secretkey.txt -O private -o secretkey.ppk
sudo vim ~/.ssh/config
Host * HostKeyAlgorithms=+ssh-rsa PubkeyAcceptedAlgorithms=+ssh-rsa
sudo cp -p /etc/fail2ban/jail.conf /etc/fail2ban/jail.d/jail.local sudo cp -p /etc/fail2ban/jail.d/jail.local /etc/fail2ban/jail.d/jail.local.org
sudo vim /etc/fail2ban/jail.d/jail.local
# [sshd] [sshd] # enabled = true enabled = true
#banaction = iptables-multiport banaction = firewallcmd-ipset #banaction_allports = iptables-allports #banaction_allports = iptables-allports
sudo service fail2ban restart sudo chkconfig fail2ban on
sudo chkconfig | less
sudo systemctl restart fail2ban sudo systemctl enable fail2ban
sudo systemctl status fail2ban
sudo fail2ban-client status sshd
Status for the jail: sshd |- Filter | |- Currently failed: 0 | |- Total failed: 5 | `- File list: /var/log/secure `- Actions |- Currently banned: 1 |- Total banned: 2 `- Banned IP list: 92.255.85.37
sudo ipset --list
Name: fail2ban-sshd Type: hash:ip Header: family inet hashsize 1024 maxelem 65536 timeout 600 Size in memory: 16632 References: 0 Members: 92.255.85.37 timeout 102