configs/arch-config/Dokumente/Server-setups/debian-ssh.md
2020-09-13 19:17:41 +02:00

1.0 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

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