Don't use ssh with passwords
Fiction:
https://medium.com/@rockprofile/so-how- ... eacd7def25A much safer method is to use Public Key Authentication.
Fact:
So if the client has been compromised, the server is also compromised. If the user copies the keys around for convenience, and one of them get compromised, the server gets compromised as well.9.4.4 Public Key Authentication The use of public key authentication assumes that the client host has not been compromised. It also assumes that the private key of the server host has not been compromised. This risk can be mitigated by the use of passphrases on private keys; however, this is not an enforceable policy. The use of smartcards, or other technology to make passphrases an enforceable policy is suggested. The server could require both password and public key authentication; however, this requires the client to expose its password to the server (see the section on Password Authentication below.)
On the other hand, passwords will get revealed if the server is already hacked.9.4.5. Password Authentication The password mechanism, as specified in the authentication protocol, assumes that the server has not been compromised. If the server has been compromised, using password authentication will reveal a valid username/password combination to the attacker, which may lead to further compromises. This vulnerability can be mitigated by using an alternative form of authentication. For example, public key authentication makes no assumptions about security on the server.
The point is that public key authentication is a feature of convenience (with its own drawbacks) and not one of security per se.
Source: https://www.rfc-editor.org/rfc/pdfrfc/rfc4251.txt.pdf
Use a firewall
Fiction: You need a firewall to stop the hackers
Fact: Firewalls work if applied correctly, like limiting outgoing traffic or preventing access to certain services.
However, it does not increase security if you allow all outgoing traffic and expose all services to the internet. Then the hacker can reach all the services. That is like running without a firewall, because all the holes are open. You have achieved nothing.
Install sudo
Fiction: ... because it's dangerous to run as root.
Fact: Issuing commands as root is probably the most common task on a server, because you do maintenance, perform upgrades or set up services. All these tasks require root privileges.
Adding an unprivileged user and elevate him to issue commands with sudo makes little sense, because you have merely replaced root with a normal user who (with sudo) can do anything root can do.
Change the default ports
Fiction: ... or you'll get hacked.
Fact: This doesn't actually increase security, because whatever login attempts you get from SSH are probably automated attacks probing for weak passwords before they move on. As long as you have a strong password, you are safe. You can also, of course, disable WAN login attempts to SSH altogether and only allow logins from your own LAN. They are almost always probing the root user, so disabling direct root logins will help if this concerns you.
Changing ports, however, will decrease noise and unwanted traffic, but it does nothing to help security in itself. If someone is targeting you, of course they'll find where your services are located.
Are there any other quack remedies?