Server Configuration¶
Disable password authentication¶
If you have set up your SSH keys, then my advice is to disable password authentication, as passwordless is more secure than password authentication.
-
Go to your remote server, find, and edit
/etc/ssh/sshd_config
. -
Search for
PasswordAuthentication
text and set it to "no".sshd_config -
Restart the SSH service
Change SSH Daemon runs/listens on port¶
By default, SSH Daemon runs/listens on port 22. You can change it as well.
-
Go to your remote server, find, and open
/etc/ssh/sshd_config
. -
Search for
Port
text and edit it based on your needs -
Restart the SSH service
Limit authenticate users to login¶
-
Go to your remote server, find, and open
/etc/ssh/sshd_config
. -
Search for
AllowUsers
orAllowGroups
, if not found, then create it anywhere. Either one should be fine, or you want to implement both too. -
Restart the SSH service
Disable root login¶
It is a good practice to disable root login
-
Go to your remote server, find, and open
/etc/ssh/sshd_config
. -
Search for
PermitRootLogin
text and set it to "no".sshd_config -
Restart the SSH service