1.1 KiB
1.1 KiB
ssh
All commands assume being logged in as root user on the server unless noted otherwise.
apt install openssh-server
systemctl enable ssh
Permit root login (will be restricted again later).
vi /etc/ssh/sshd_config
Find PermitRootLogin without-password
and change it to PermitRootLogin yes
. Remove the #
in front of it if there is one.
systemctl restart ssh
Add ssh-keys
This command has to be run from the computer you want to have ssh access through keys later.
ssh-copy-id -i <file location> <user>@<ip/domain>
In the location of the ssh public keys has to be inserted. The default is ~/.ssh/id_rsa.pub.
In case you have not yet created an ssh-key, run the following command.
ssh-keygen
To create ed25519 keys, execute the following command.
ssh-keygen -t ed25519
Disable password access
vi /etc/ssh/sshd_config
Find PasswordAuthentication yes
and change it to PasswordAuthentication no
. Remove the #
in front of it if there is one.
systemctl restart ssh