Secure Shell
Link
Notes
The Secure Shell Protocol (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network.[2] Its most notable applications are remote login and command-line execution.
Source: Wikipedia
FAQ
Download a directory from a SSH server into an archive
scp -r username@hostname:/path/from/remote /path/to/local
Source: StackOverflow
Could not load host key: /etc/ssh/ssh_host_ed25519_key
If you’re getting this error message in the log file, you most likely have the ed25519 HostKey enabled in your sshd_config file but for some reason, no host key was generated for it.
Since openssh-6.4 you can run the ssh-keygen command to generate any missing host keys:
ssh-keygen -A
Source: https://trick77.com/could-not-load-host-key-etcsshssh_host_ed25519_key/
Starting OpenSSH client from Python
subprocess.call([
"ssh", # Path to ssh
"-i", # Use private key file
"~/.ssh/id_rsa", # Path to private key
"user@hostname" # Host and username to connect with
])
Changing the comment field of an RSA key
All I had to do was
ssh-keygen -c -C "my new comment" -f ~/.ssh/my_ssh_key
Source: SuperUser
Switching directory automatically after connecting with SSH
Add an entry in the local SSH config:
Host SOME_HOSTNAME
RemoteCommand cd DESIRED_DIRECTORY ; /usr/bin/env bash
RequestTTY yes
Resources
- ArchWiki: SSH keys
- Howto secure openssh-6.x
- How to Harden SSH with Identities and Certificates
- OpenSSH - MozillaWiki
The goal of this document is to help operational teams with the configuration of OpenSSH server and client.
- new openssh key format and bcrypt pbkdf
- OpenSSH key management on Windows 10, Windows Server 2019 and Windows Server 2022