Skip to content

SSH

https://www.openssh.com/

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

Download a directory from a SSH server into an archive

Section titled “Download a directory from a SSH server into an archive”
Terminal window
scp -r username@hostname:/path/from/remote /path/to/local

Source: StackOverflow

Could not load host key: /etc/ssh/ssh_host_ed25519_key

Section titled “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:

Terminal window
ssh-keygen -A

Source: https://trick77.com/could-not-load-host-key-etcsshssh_host_ed25519_key/

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
])

All I had to do was

Terminal window
ssh-keygen -c -C "my new comment" -f ~/.ssh/my_ssh_key

Source: SuperUser

Switching directory automatically after connecting with SSH

Section titled “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
Terminal window
ssh -A user@host

See Gemini conversation