sshd -v
~.
The ssh log, auth.log, is no longer at /var/log/secure.
Use:
journalctl -u sshd
Tail with:
journalctl -fu sshd
systemctl status sshd.service
systemctl restart sshd.service
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
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-keygen -lf ~/.ssh/rsa_key.pub
To kick an ssh session:
who -u
:: Get the pid
kill <pid>
View ssh sessions with start and end times:
last -F
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>
To use ssh to launch a remote script that uses sudo, pass the
-t
flag:
ssh -l user host -t 'sudo ls'
ssh -vv <your-host>