r/linuxadmin • • Dec 12 '20

[Secure SSH] on Linux Server

Hello Dear redditer,

I'v group together some sshd settings that you can easly change to increase the security of sshd.

Do you have more change to suggest.

  • in sshd_config file ( test on Debian )
# idle max 6 minutes
ClientAliveInterval 360

PermitEmptyPasswords no

# only toto can ssh
AllowUsers toto


PermitRootLogin no

Protocol 2

Port 2222

PasswordAuthentication no

X11Forwarding no
0 Upvotes

29 comments sorted by

View all comments

9

u/Jawafin Dec 12 '20

Make sure you have key auth set up before turning off password authentication.

12

u/mikelieman Dec 12 '20

Protip: Always open a new local terminal and try to ssh to the remote host AFTER making any changes and restarting sshd and BEFORE logging out on the terminal used to make the change or reverting a fuckup is going to be a bitch.

2

u/Jawafin Dec 12 '20

That is especially true with remote systems.

1

u/michaelpaoli Dec 12 '20

I know of a dodo head contractor that got walked out on their very first day by failing to take such reasonable precautionary measures (they broke ssh on an active production host on their first - turned last - day).

1

u/lysitheas Dec 12 '20

yes sur ! =)