SSH configuration for Mac and Linux

# goto you homedirectory

cd

# create a .ssh directory

mkdir .ssh

# goto .ssh directory

cd ~/.ssh

# create a ssh keypair

ssh-keygen -t rsa -C HPC -f id_rsa_hpc

# enter 2 times a secret word called "passphrase"

# Save this passphrase in a digital save because you need this later on.

# now you created 2 files like this

-rw------- 1 wvanburen users 1766 Mar 27 11:47 id_rsa_hpc
-rw-r--r-- 1 wvanburen users 385 Mar 27 11:47 id_rsa_hpc.pub

# copy and paste the content of the public-key named id_rsa_hpc.pub

# and mail this to hpc-systems@lists.umcutrecht.nl

# After the admins configured your public key on the gateway you can try to login into the hpc gateway by

ssh -i ~/.ssh/id_rsa_hpc -l wvanburen hpcgw.op.umcutrecht.nl

(Give only once a Yes to add the serverkey to your know_hosts file in your .ssh directory)

and enter your selfmade passphrase

Once you entered the gateway you can continue to log in into the HPC by:

ssh hpcs03

or

ssh hpcs04

and answer with your HPC-password And you are on the HPC now

You can automate this procedure to create a ssh-config files called "config" in your .ssh directory. This is an example . Copy and save this file in the .ssh directory and call it config.

#############################################
# file : ~/.ssh/config
# date : 20200327
# expl : default ssh config file example 
#############################################

# usage : ssh hpcgw
Host hpcgw
  HostName hpcgw.op.umcutrecht.nl
  User wvanburen
  Protocol 2
  Port 22
  IdentityFile ~/.ssh/id_rsa_hpc

# usage : ssh gw2hpcs03
Host gw2hpcs03
  HostName hpcs03.op.umcutrecht.nl
  User wvanburen 
  Port 22
  Protocol 2
  ProxyCommand ssh -i ~/.ssh/id_rsa_hpc -l wvanburen hpcgw.op.umcutrecht.nl nc %h %p 2>/dev/null

# usage : ssh gw2hpcs03X
Host gw2hpcs03
  HostName hpcs03.op.umcutrecht.nl
  User wvanburen 
  Port 22
  Protocol 2
  ForwardX11 yes
  ProxyCommand ssh -X -i ~/.ssh/id_rsa_hpc -l wvanburen hpcgw.op.umcutrecht.nl nc %h %p 2>/dev/null

# usage : ssh gw2hpcs04
Host gw2hpcs04
  HostName hpcs04.op.umcutrecht.nl
  User wvanburen 
  Port 22
  Protocol 2
  ProxyCommand ssh -i ~/.ssh/id_rsa_hpc -l wvanburen hpcgw.op.umcutrecht.nl nc %h %p 2>/dev/null

# usage : ssh gw2hpcs04X
Host gw2hpcs04
  HostName hpcs04.op.umcutrecht.nl
  User wvanburen 
  Port 22
  Protocol 2
  ForwardX11 yes
  ProxyCommand ssh -X -i ~/.ssh/id_rsa_hpc -l wvanburen hpcgw.op.umcutrecht.nl nc %h %p 2>/dev/null

# usage : ssh gw2hpct01
Host gw2hpct01
  HostName hpct01.op.umcutrecht.nl
  User wvanburen 
  Port 22
  Protocol 2
  ProxyCommand ssh -i ~/.ssh/id_rsa_hpc -l wvanburen hpcgw.op.umcutrecht.nl nc %h %p 2>/dev/null

# usage : ssh gw2hpct02
Host gw2hpct02
  HostName hpct02.op.umcutrecht.nl
  User wvanburen 
  Port 22
  Protocol 2
  ProxyCommand ssh -i ~/.ssh/id_rsa_hpc -l wvanburen hpcgw.op.umcutrecht.nl nc %h %p 2>/dev/null

# usage : ssh hpcs03
Host hpcs03
  HostName hpcs03.op.umcutrecht.nl
  User wvanburen 
  Port 22
  Protocol 2

# usage : ssh hpcs03X
Host hpcs03X
  HostName hpcs03.op.umcutrecht.nl
  User wvanburen 
  Port 22
  ForwardX11 yes

# usage : ssh hpcs04
Host hpcs04
  HostName hpcs04.op.umcutrecht.nl
  User wvanburen 
  Port 22
  Protocol 2

# usage : ssh hpcs04X
Host hpcs04X
  HostName hpcs04.op.umcutrecht.nl
  User wvanburen 
  Port 22
  Protocol 2
  ForwardX11 yes

# usage : ssh hpct01
Host hpct01
  HostName hpct01.op.umcutrecht.nl
  User wvanburen 
  Port 22
  Protocol 2

# usage : ssh hpct02
Host hpct02
  HostName hpct02.op.umcutrecht.nl
  User wvanburen 
  Port 22
  Protocol 2

# usage : ssh ft_gw2hpct01
#         then start a filezilla session on localhost
# for filetransfer from hpct01 to local machine
Host ft_gw2hpct01
  HostName hpct01.op.umcutrecht.nl
  User wvanburen 
  Protocol 2
  ProxyCommand ssh -X -i ~/.ssh/id_rsa_hpc -L 8888:hpct01.op.umcutrecht.nl:22 -l wvanburen hpcgw.op.umcutrecht.nl nc %h %p 2>/dev/null

# usage : ssh ft_gw2hpct02
#         then start a filezilla session on localhost
# for filetransfer from hpct01 to local machine
Host ft_gw2hpct02
  HostName hpct02.op.umcutrecht.nl
  User wvanburen 
  Protocol 2
  ProxyCommand ssh -X -i ~/.ssh/id_rsa_hpc -L 8888:hpct02.op.umcutrecht.nl:22 -l wvanburen hpcgw.op.umcutrecht.nl nc %h %p 2>/dev/null

-- Rene Janssen - 2020-03-27

Comments

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r1 - 2020-03-27 - ReneJanssen
 
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback