Check out aiproxy.pro


(ssh, disconnect from stale session)


(sshd log, ssh, Amazon Linux 2023)

The ssh log, auth.log, is no longer at /var/log/secure.

journalctl -u sshd

Tail with:
journalctl -fu sshd

(sshd, get status, restart, Amazon Linux 2023)

systemctl status sshd.service  
systemctl restart sshd.service  

(sshd, change port, Amazon Linux 2023)

cp /etc/ssh/sshd_config /etc/ssh/sshd_config.bak  
sed "/^#Port 22/i Port 5083" /etc/ssh/sshd_config | sudo tee /etc/ssh/sshd_config  
systemctl restart sshd.service  


(ssh, forward agent, forwardagent, setup)

Verify that my key is found in ssh agent:

ssh-add -L  

If this returns “The agent has no identities”, add my key with:

ssh-add -k ~/.ssh/<my-private-key>  

Next verify that ~/.ssh/config contains:

Host myhost  
ForwardAgent yes  

Use forward agent:

local> ssh <my-host>  
my-host> ssh <another-host>  

(ssh, print fingerprint, public key)

ssh-keygen -lf ~/.ssh/rsa_key.pub  


(ssh, kick out user, logout session, session start and end time)

To kick an ssh session:

who -u  
:: Get the pid  
kill <pid>  

View ssh sessions with start and end times:

last -F  


(ssh, ssh-agent, add and remove keys)

Make sure key is in ssh-agent:

ssh-add -L  

To remove all keys in ssh-agent:

ssh-add -D  

To add key to ssh-agent:

ssh-add -k <private-key>  


(ssh, remote script, sudo, cleartext, no visible password)

To use ssh to launch a remote script that uses sudo, pass the -t flag:

ssh -l user host -t 'sudo ls'  


(ssh, debugging info)

ssh -vv <your-host>