To make an ssh connection, execute the following command.
ssh -i Certificate path username@IP address
If you use it often, you can use config and execute it with the following command.
ssh host name
Storage destination → ~ / .ssh / config
The contents of the file are as follows.
config
Host DataLamda_Outer
HostName IP or DNS
User Connected user
Port Connection destination port
IdentityFile key file
As shown below, I created a shell that can get a list of connected hosts.
sshls
#!/bin/sh
SSH_CONFIG=$HOME/.ssh/config
echo "known hosts:"
if test -e $SSH_CONFIG; then
for i in `grep "^Host " $SSH_CONFIG | sed s/"^Host "//`
do
echo " ${i};"
done
else
echo "nothing ssh-lsconfig file"
fi
There are three steps to make it a command.
chmod 755 sshls
The execution result looks like this
$sshls Sat 6/13 23:08:17 2020
known hosts:
DataLamda_Outer;