10/23/2017 - 4:30 PM

SSH key commands

Variety of commands ot do things with SSH Keys.

# remove ssh key from known_hosts
ssh-keygen -R 'Hostname/IP'

# create new ssh key
ssh-keygen -t rsa -b 4096 -C "key_name"

# copy ssh key from id_rsa (single key for that server/service)
pbcopy < ~/.ssh/

# print ssh from id_rsa to console
cat ~/.ssh/

# test ssh connection
ssh -T
# change for alternative places

# debug connecting via ssh
ssh -vT "hostname/url"

# to allow new users to sign in, allow password login & reset ssh
# go to /etc/ssh/sshd_config
# edit PasswordAuthentication to yes
# go back to root
sudo service ssh restart

# active a basic firewall (UFW manages application access)
sudo ufw app list
sudo afw allow OpenSSH
sudo ufw enable
sudo ufw status