Ubuntu - Sharing SSH Keys

Sharing keys on Ubuntu is as easy as: ssh-copy-id user@hostname.domain.com If you want to use a specific key, then use the following ssh-copy-id -i [PUBLIC KEY FILE] user@hostname.domain.com If you don't already have an identity, an error will pop up and you will need…

Read this article

Fix SSH Connections to Ubuntu 16.04 not Exiting Cleanly

If you find that your terminal is left hanging after you reboot or poweroff the server you are connected to, then there is a simple fix. sudo apt-get install libpam-systemd dbus This requires UsePAM yes to be set in your /etc/ssh/sshd_config file, but this should be the…

Read this article

CentOS 7 - Disable Root Login

#!/bin/bash SEARCH="#PermitRootLogin yes" REPLACE="PermitRootLogin no" FILEPATH="/etc/ssh/sshd_config" sudo sed -i "s;$SEARCH;$REPLACE;" $FILEPATH sudo service sshd restart The script is exactly the same for debian users, except the last line in which you need to change sshd to ssh…

Read this article

Debian - Close SSH Connections Before Turning Off

With the default Debian 8.1 installation, whenever I send the command to turn off or restart my server, my terminal that is connected via SSH is left hanging and unresponsive. Luckily this can be easily resolved by executing: sudo apt install libpam-systemd dbus Then you need to reboot for…

Read this article

Managing Multiple SSH Keys

Hopefully, you aren't using a single SSH key for authenticating into absolutely everything. You should be using multiple SSH keys to provide isolation levels. You may be tempted to use just a single key because itt can be quite cumbersome to remember which key you need for which hosts, and…

Read this article

Managing Encryption Keys (ssh/ssl)

Decrypting a Key If you want to decrypt your SSH key, run the following command: openssl rsa -in \ [existing name] \ -out \ [new unencrypted file name] Encrypting a Key If you want to encrypt your currently non-encrypted key, then run the following command instead: aes256 openssl rsa -aes256 \ -in [existing name]…

Read this article

Ubuntu - SSH Two Factor Authentication

Let me start by saying that security is a mindset, not an application. The best way to secure one's systems is to configure as many layers of security as possible and be careful with one's credentials. No single system or application will guarantee complete protection, but setting up many barriers…

Read this article