The default sshd_config allows anyone with a valid user account to login using passwords. I don't understand why those changes were necessary to allow you to login.
Subsystem sftp /usr/libexec/sftp-server
There is no need to add password to your ssh-key. It's already far more secure than logins using a password. I don't use passwords with my ssh-key since nobody else have access to my computer. However, its up to you how you want to set it.
No, please. On a standard system your secret keyfile is readable by any process run under your user account and you'll put that secret key under an enormous risk if your key file is not protected by a PIN code (well password but technically it functions as a PIN code). Any programming error in an application that allows a remote attacker to read arbitrary files from your home directory will be able to steal your secret key.
This is the very reason why web browsers have moved to sandboxed extensions. The extensions are run in a "fake" environment where only the necessary part of the environment are present and sensitive parts of the users home directory are not available.
AllowUsers you@192.168.0.0/16
in sshd_config and that will only allow SSH connections from that remote IP address. Configuring firewall is another way of restricting SSH connections from specific IP range and I use non-standard port for SSH too. AllowUsers
is not required. I was confused because when that command is used, it grants permission to only the users listed. Although when it is removed completely, all users have access (I thought no uses would have access). So now the only thing I have actually added to the entire file since being locked out is PasswordAuthentication yes
. Or is this also somehow not required? If so then I'm a little confused as to why I was ever "locked out"...It shouldn't be needed actually. All my systems run the default sshd_config and I can login using any valid user. Both with 'regular' passwords and by using using keys.So now the only thing I have actually added to the entire file since being locked out is PasswordAuthentication yes. Or is this also somehow not required?
It shouldn't be needed actually. All my systems run the default sshd_config and I can login using any valid user. Both with 'regular' passwords and by using using keys.
To allow only keys you need to set PasswordAuthentication and ChallengeResponseAuthentication to no. Which provides an answer to the first question too, PasswordAuthentication is set to yes by default, setting it explicitly in the config doesn't actually change it.
service sshd reload