Trying to SSH to lab's servers at home using my mac, it was impossible to login/SSH/Ping to those servers as only local traffics were allowed.
Thus,today I am trying to access local servers via SKKU's(my university) opened servers uni.skku.edu
via SSH JUMP HOST
#To B1
Local MAC -----> uni.skku.edu -----> b1 server
#TO Black
Local MAC -----> uni.skku.edu -----> black server
Solutions were driven from TecMint:
https://www.tecmint.com/access-linux-server-using-a-jump-host/
https://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/
Before setting up SSH Jump, I needed to make a passowrdless login environment, because info were all different per servers, and it would be a huge burden to type all of them everytime.
First, in the local client computer(mac), generate a pair of public keys using:
ssh-keygen -t rsa
#then press "ENTER" 4 times
send a copy of the SSH key to the remote server using:
ssh-copy-id brian11hwang@uni.skku.edu -p 1398
This may not work at first due your mac not allowing SSH connections. Allow this via:
1. Select "System Preferences."
2. Click on "Sharing."
3. In the list on the left, check the box for "Remote Login."
Also, you may need to Setup Port Forwarding
Next time I login, I can see that I could enter passwordlessly.
As I would need paswordless access from uni to b1 and black, I repeated the steps once again.
Since I know all the hosts to jump, I will be using a Static Jump Host as below:
In ~/.ssh/config
:
-q – This stands for quiet mode. It suppresses warnings and diagnostic messages.
-W – Requests that standard input and output on the client be forwarded to HOST on PORT over the secure channel.
%h – Specifies the host to connect to.
%p – Specified the port to connect to on the remote host.
Then, restart SSH Daemon via:
sudo systemctl restart ssh
xxh allows you to use your local ssh environment (plugins, themes etc) in you ssh environment.
First, install xxh
and sshpass
using:
brew install xxh
brew install hudochenkov/sshpass/sshpass
Then, simply use xxh
instaed of ssh
.