Debian 8 Setup System
1. Change SSH Port
Change SSH port.
Remove # and change 22 to other port number.
Restart the sshd service:
service sshd restart
Shortcut connect script file.
#!/bin/sh ssh -p 22233 root@host -o ServerAliveInterval=30
You can login with this command:
2. Add SSH Public Key to Server
Run ssh-keygen on your machine, and just hit enter when asked for a password.
This will generate both a private and a public key. With older SSH versions, they will be stored in ~_.sshidentity and ~.sshidentity.pub; with newer ones, they will be stored in ~.ssh_idrsa and ~.ssh_idrsa.pub.
Next, add the contents of the public key file into ~.ssh_authorized_keys on the remote site (the file should be mode 600).
This step may need “mkdir .ssh” directory
3. Disable Password Authentication
vi /etc/ssh/sshd_config ChallengeResponseAuthentication no PasswordAuthentication no UsePAM no service sshd restart
4. Update System
apt-get update apt-get dist-upgrade