Configure & Secure SSH Flashcards
What username will be prompted for a password when omiting username from the ssh command? (e.g. ssh hostname
)
The current user’s username.
What CLI command will log you out of an ssh connection?
exit
What CLI command will initiate an ssh connection as username with host server.
ssh username@host
What CLI command will show the hostname of a remote server without accessing the remote interactive shell?
ssh username@host hostname
What Linux CLI command will list the currently logged in users along with the remote location they logged in from?
w -f
In what files (global and user) are the public keys for known hosts kept?
/etc/ssh/ssh_known_hosts
and ~/.ssh/known_hosts
With StrictHostKeyChecking
enabled, what will happen if the public keys don’t match on ssh login?
ssh
will abort the connection.
In what two ways can you enable Strict HostKeyChecking
for ssh connections?
- Add
StrictHostKeyChecking=yes
to~/.ssh/config
or/etc/ssh/ssh_config
- Add the option
-o StrictHostKeyChecking=yes
to the ssh command
Red Hat recommends always enabling StrictHostKeyChecking
.
What CLI command is used to display a host’s ssh public key?
ssh-keygen -lf /etc/ssh/filename.pub
How does Red Hat recommend sharing a hosts public key for use with ssh?
Use an out-of-band communication channel such as email, phone call, or video conference.
What three fields are contained in a hosts entry in the client’s known_hosts file?
- hostname or IP address
- Encryption algorythm used
- the public key
What must you do if ssh warns that a remote host’s identification has changed?
Manually modify the clients known_hosts file with the correct public key or IP address, or remove the host’s entry from the file and reconnect to obtain a new public key.
This warning is an indication of a possible malicious attack.
What CLI command will find and remove a host’s key entry from the known_hosts file?
ssh-keygen -R *remotehostname* -f filename(
~/.ssh/known_hostsor
/etc/ssh/ssh_known_hosts)
Wher does the
ssh-keygencommand save your public and private keys by default?
~/.ssh/id_rsaand
~/.ssh/id_rsa.pub
What CLi command will generate a key pair for ssh login?
ssh-keygen