Instructions for setting up the SSH Server on Linux
So far a very incomplete list of things to do to make the computer running SSH Server more secure. You will need root privileges to edit the sshd_config
file. This file is found in different places, here is where I know where to look for it:
distro | filepath |
---|---|
Ubuntu 20.04 | /etc/ssh/sshd_config |
As a last resort you can use locate
or find
to find the config file.
After you make any changes to sshd_config
you will need to reload the server. If you’re running systemd you’ll run
And, if you’re running sysvinit you’ll run:
This will confuse basic port sniffers that check to see if port 22 is open. Edit the sshd_config
file and add or edit this line:
Why do this? SSH Keys are probably more secure than your password, thus are harder to crack!
sshd_config
file. The default is to allow SSH Key Authentication, but make sure this line is included in yoru config: bash PubkeyAuthentication yes
bash ssh-keygen -t rsa -b 2048 -f ~/.ssh/server_rsa_file
~/.ssh/authorized_keys
, but you can also do it manually. bash ssh-copy-id -i ~/.ssh/server_rsa_file.pub USER@HOST
bash ssh -i ~/.ssh/server_rsa_file USER@HOST
This won’t allow a user to log in with their password. CAREFUL: You will need to enable SSH Keys before you do this! Edit the sshd_config
file and add or edit this line:
Notes on Computers
AWS · Bash · C · C++ · Cyber Security · Git · LaTeX · Linux · Networking · Python · Raspberry Pi · Tools · Vim
Notes on Math & Physics
Information Theory · Linear Algebra · Solid State Physics
Copyright 2021 · Eric D. Weise