Categories
Uncategorized

How to manage remotely forwarded SSH authentication agent

Keeping SSH authentication agent in sync across multiple servers and terminal multiplexers is not an easy task, but can be solved by using consistent socket names used to connect to the SSH authentication agent.

Categories
Uncategorized

How to attach to tmux session over SSH

Attach to the tmux session over SSH to continue your work.

Categories
SysOps

How to remotely execute shell function

Sometimes it is very convenient to define shell function and execute it remotely.

Categories
SysOps

How to instantly add known_hosts entries for host and its IP address

Use simple shell function to instantly create known_hosts entries for specified host, including its IP address and remove outdated public host keys.

Categories
Uncategorized

How to merge multiple known_hosts entries into single row

Global known_hosts file located in /etc/ssh/ssh_known_hosts and user managed ~/.ssh/known_hosts contains known host public keys. Due to its nature these files can contain multiple entries using the same key. It is not a problem, but merging entries using the same key is the first step that is necessary to inspect it visually and to verify host entries.

Categories
Uncategorized

How to disconnect idle SSH clients

Disconnect idle SSH clients using built-in client alive mechanism.

Categories
Uncategorized

How to remove invalid entries from known hosts file

There are rare cases when known hosts file becomes corrupted, so basic ssh utilities fail within custom built shell scripts due to ~/.ssh/known_hosts is not a valid known_hosts file error.

Categories
Uncategorized

How to change SSH private key passphrase

From time to time I have to update passwords used to secure private keys to keep myself a bit more sane.
I will demonstrate simple and straightforward way to accomplish this task.

Categories
SysOps

How to create persistent reverse SSH tunnel

Sometimes I want to access a private server at home from a different network while being on the go.
The easiest way to do this is to use autossh utility to create a secure and persistent reverse SSH tunnel to the publicly available server.