[Legacy Link]
[Link]
Instructions
From the reference link, there are ten of them, but for my personal view point, i though below skills are the most import.
By editing the configuration /etc/ssh/sshd_config
1
|
vim /etc/ssh/sshd_config
|
Disable empty password
1
|
PermitEmptyPasswords no
|
Disable root login
1
|
AllowUsers {user1} {user2}
|
Only using SSH protocal 2
Change porte
1
|
Port {other port than 22}
|
Use key file
Refers to Use public/private key for authentication
Enable two factor authentication
Refers to How to add google authenticator to ssh [centos]
After the configuration set, the sshd service needs to be restart.
1
2
|
/etc/init.d/sshd restart
# or service sshd restart
|
Update host key
[Test SSH1]
[Test SSH2]
[Gen new host key]
1
2
3
4
5
6
|
ssh-keygen -b 8192 -f /etc/ssh/ssh_host_rsa_key_regen -N '' -t rsa
ssh-keygen -f /etc/ssh/ssh_host_ed25519_key_regen -N '' -t ed25519
# ecdsa maybe NSA backdored
# Do not use
#ssh-keygen -f /etc/ssh/ssh_host_ecdsa_key -N '' -t ecdsa -b 521
|
Update /etc/ssh/sshd_config
1
2
3
4
5
6
7
8
|
HostKey /etc/ssh/ssh_host_rsa_key_regen
#HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key_regen
#Comment below key
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
|
Update opensshserver.config
1
|
vim /etc/crypto-policies/back-ends/opensshserver.config
|
Related articles