There are some inconveniences login via ssh.
The first thing is timeout, the sshd always drop connections after certain idle time interval by default, it’s really annoy if you are not care this secure consideration.
We can disable this timeout mechanism by adding the following configs into sshd configuration file.
# File: /etc/ssh/sshd_config ClientAliveInterval 30 TCPKeepAlive yes ClientAliveCountMax 99999
We also can login via public keys instead of entering the password every time. Just run the following commands:
# Generate the ssh keys: ssh-keygen -t rsa # Copy the public key into hosts' authorized_keys cat ~/.ssh/id_rsa.pub | ssh email@example.com "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
We can then turn off the password login to secure our hosts:
# Edit: /etc/ssh/sshd_config PermitRootLogin without-password