SSH-SFTP-Server

SSH Server mit Benutzer und Passwort Authentifizierung

 

sudo apt install -y openssh-server

sudo nano /etc/ssh/sshd_config

LoginGraceTime 30
 PermitRootLogin no
 StrictModes yes
 MaxAuthTries 2
 AllowUsers (hier muss der user rein der den server benutzt)

sudo /etc/init.d/ssh restart

 

SSH Server mit Two Factor Authentifizierung

 

sudo apt-get install-y libpam-google-authenticator openssh-server

sudo nano /etc/pam.d/sshd

auth required pam_google_authenticator.so

sudo nano /etc/ssh/sshd_config

ChallengeResponseAuthentication yes

sudo service ssh restart

google-authenticator

 

SSH Server mit Key Authentifizierung

 

sudo apt install -y openssh-server

ssh-keygen -b 4096

cd .ssh

mv id_rsa.pub authorized_keys1

chmod 600 ~/.ssh/authorized_keys1

sudo nano /etc/ssh/sshd_config

ChallengeResponseAuthentication no
 PasswordAuthentication no
 UsePAM no

sudo service ssh restart

SSH Server mit Key ED25519 Authentifizierung

 

sudo apt-get install openssh-server

ssh-keygen -t ed25519

sudo nano /etc/ssh/sshd_config

HostKey /etc/ssh/ssh_host_ed25519_key

PermitRootLogin no

RSAAuthentication no
 PubkeyAuthentication yes
 #AuthorizedKeysFile %h/.ssh/authorized_keys

IgnoreUserKnownHosts yes

PasswordAuthentication no

UsePAM no

sudo /etc/init.d/ssh restart