Ways of making sshd more secure?

I have a PC with Manjaro and a phone with TermuxArch. I want to use the phone to SSH into PC when I'm not home. This means I'll have to make sshd as secure as possible. What can I do to achieve it?

What I have already done:

  1. Replaced password with pubkey

  2. Changed sshd port number

P.S: if I enable both pubkey and OTP (Google Authenticator) so that both are used, sshd fails to start.

Posted Dec 15, 2019, 11:52 AM UTC

25
EddyBot•

Set up a VPN (Wireguard or OpenVPN) and only allow ssh access within the VPN network
bonus point: You can use the VPN to securely surf on public wifi access points

4
1BadDawg•
  1. Yes, absolutely.

  2. That'll help, but don't depend on it. There are a lot of port scans going on, on the internet. It'll eventually be found.

To harden up mine, I specified which users are allowed, and set root user to no. And my username isn't "common". Just another layer.

3
d3vrandom•

restrict which IPs can connect to the sshd port on the server. if you know what IP addresses your ISP assigns to your phone you can use iptables to add this restriction.

mind you you don't have to do the above. what you've already done is good enough for 99% of cases. it's only if there's a zero day in sshd that you are in trouble.

2
2cats2hats•

2 won't change all that much.

Look into fail2ban

1
C0rn3j•

>Replaced password with pubkey

Keep the machine up to date and it's as secure as long as your private key is.

1