Debian 8 Setup System
Chengzhi Yang 2016-12-01
1. Change SSH Port
Change SSH port.
Remove # and change 22 to other port number like 22233.
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 ~/.ssh/identity and ~/.ssh_identity.pub; with newer ones, they will be stored in ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub.
Next, add the contents of the public key file into ~/.ssh/authorized_keys on the remote host (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