Useful Commands
You can use the tail
command along with the /var/log/auth.log
file
to see real-time logs of SSH login attempts on your server. Here's how to do it:
sudo tail -f /var/log/auth.log
auth.log
file and continuously update
the output as new log entries are added.
auth.log
file, along with the username and IP address of the user.
You can use this information to identify any unauthorized login attempts to your SSH server and take appropriate
action to secure your system. Note that the auth.log
file may be located in a different path depending
on your distribution.
To check the SELinux status for OpenSSH, you can use the sestatus
command. Here's how to do it:
sestatus
Current mode
line in the output. If SELinux is enabled, the mode should be set to
enforcing
. If disabled, it will say disabled
.
Here's a cheat paper for using SSH commands to query SSH keys, ciphers, and FIDO2 hardware tokens:
ssh -Q key
This will display the list of supported SSH key types on your system, including sk-ssh-ed25519@openssh.com, which represents the Ed25519 key type used for FIDO2 hardware tokens. SSH key types on your system, including sk-ssh-ed25519@openssh.com, which represents the Ed25519 key type used for FIDO2 hardware tokens.
ssh -Q cipher
This will display the list of supported SSH ciphers on your system, which are used for encryption and decryption of SSH communications.
The -sk
option allows you to use a FIDO2 hardware token as a security key for SSH authentication.
sk-ssh-ed25519@openssh.com
and
sk-ssh-ed25519-cert-v01@openssh.com
.
sk-ssh-ed25519@openssh.com
represents the standard Ed25519 key type used for FIDO2 hardware token-based user authentication, while
sk-ssh-ed25519-cert-v01@openssh.com
is a certificate-based key used for host authentication.
The sk-ssh-ed25519-cert-v01@openssh.com key type is a certificate-based key used for FIDO2 hardware token-based host authentication. This key type is tied to a specific target/SSH server, identified by its hostname and user. In other words, the key pair can only be used for a single target/SSH server with the correct hostname and user — providing an added layer of security.