Setting a Cipher in .ssh/config (Client-Side)
To specify a cipher for an SSH connection in the client configuration file(~/.ssh/config
), use the Ciphers
directive.
Example: Setting a Preferred Cipher for a Specific Host:
Host remote-server
Ciphers aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
To enforce a specific ciphers for all SSH connections, use:
Host *
Ciphers aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
Verifying the Cipher in Use
To check which cipher is being used for an SSH connection, run:
ssh -vv user@remote-server | grep "cipher"
Example Output:
debug1: kex: algorithm: curve25519-sha256
debug1: cipher: aes256-gcm@openssh.com