Generating SSH Keys for Bastion access
The steps below will create a new ssh key pair. If you already have working a ssh key pair, please send us the public id_rsa.pub file to add to bastion.
Please see the steps below for the Operating System or computer you will be using.
Windows 11
- Open the windows command line (type "cmd" on the search box and hit enter).
- It'll default to your home folder, so you don't need to cd to a different one.
- Type ssh-keygen
- Leave the first parameter empty(default), enter a password if you like, or leave it empty
- Your ssh keys should be stored at chosed directory, the default is: /c/Users/YourUserName/.ssh/id_rsa.pub
MacOSX
- Open the Terminal App and enter the text below:
ssh-keygen -t rsa - Choose the default location for the keys. It will say “(/Users/loginname/.ssh/id_rsa)”. Hit Return.
- It will now say “Enter passphrase (empty for no passphrase):”. Enter your passphrase and press Return. You are asked to re-enter the password to confirm you typed it correctly.
- Terminal will now say “Your identification has been saved in /Users/loginname/.ssh/id_rsa” and “Your public key has been saved in /Users/loginname/.ssh/id_rsa.pub.”
Linux
- Open a terminal window and enter the text below:
ssh-keygen -t rsa - Choose the default location for the keys. It will say “(/home/loginname/.ssh/id_rsa)”. Hit Return.
- It will now say “Enter passphrase (empty for no passphrase):”. Enter your passphrase and press Return. You are asked to re-enter the password to confirm you typed it correctly.
- Terminal will now say “Your identification has been saved in /home/loginname/.ssh/id_rsa” and “Your public key has been saved in /home/loginname/.ssh/id_rsa.pub.”
Send us the public key to add to the servers.
We will update when your public key has been added to the servers and you can follow the steps below to ssh to shell.sas.
ssh to shell.sas
* Check that you can ssh to shell.sas by using the following command.
- ssh -J
* Once successful you can shorten the above command by using an ssh config file.
The ssh config file will be in the following location
Windows – C:\Users\YourLoginName\.ssh\config
MacOSX - /Users/YourLoginName/.ssh/config
Linux - /home/YourLoginName/.ssh/config
* Create the ssh config file with the following contents or copy and paste. Replace NETID with your netid and replace id_rsa with your key name if its different.
Host bastion
User NETID
HostName bastion.sas.rutgers.edu
IdentityFile ~/.ssh/id_rsa
ServerAliveInterval 240
ServerAliveCountMax 2
Host shell1.sas
User NETID
HostName shell1.math.rutgers.edu
IdentityFile ~/.ssh/id_rsa
ServerAliveInterval 240
ServerAliveCountMax 2
ProxyJump bastion
* You should now be able to ssh to shell.sas by entering the following command
- ssh shell.sas