Difference: SshCommandLine (2 vs. 3)

Revision 32020-03-27 - MartinMarinus

Line: 1 to 1
 
META TOPICPARENT name="FirstTimeUsers"

SSH configuration for Mac and Linux

# goto your 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"
# Put this passphrase in a "digital safe" ( p.e. KeepAss see: https://keepass.info/ ) 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
Added:
>
>
 And you are on the HPC now
Changed:
<
<
You can automate this procedure to create a ssh-config files called "config" in your .ssh directory.
>
>
You can automate this procedure by creating as ssh-config file. It should be located in your ".ssh" directory, and be called "config".
 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
Deleted:
<
<
Protocol 2 Port 22
  IdentityFile ~/.ssh/id_rsa_hpc

# usage : ssh gw2hpcs03 Host gw2hpcs03 HostName hpcs03.op.umcutrecht.nl User wvanburen

Deleted:
<
<
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

Changed:
<
<
Host gw2hpcs03
>
>
Host gw2hpcs03X
  HostName hpcs03.op.umcutrecht.nl User wvanburen
Deleted:
<
<
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

Deleted:
<
<
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

Changed:
<
<
Host gw2hpcs04
>
>
Host gw2hpcs04X
  HostName hpcs04.op.umcutrecht.nl User wvanburen
Deleted:
<
<
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

Deleted:
<
<
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

Deleted:
<
<
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

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

# usage : ssh hpcs04 Host hpcs04 HostName hpcs04.op.umcutrecht.nl User wvanburen

Deleted:
<
<
Port 22
  Protocol 2

# usage : ssh hpcs04X Host hpcs04X HostName hpcs04.op.umcutrecht.nl User wvanburen

Deleted:
<
<
Port 22 Protocol 2
  ForwardX11 yes

# usage : ssh hpct01 Host hpct01 HostName hpct01.op.umcutrecht.nl User wvanburen

Deleted:
<
<
Port 22 Protocol 2
  # usage : ssh hpct02 Host hpct02 HostName hpct02.op.umcutrecht.nl User wvanburen
Deleted:
<
<
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
Deleted:
<
<
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

Deleted:
<
<
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 #########################################

With this oneliner you can replace wvanburen in your own username int the file "~/.ssh/config"

sed -i 's/wvanburen/my_username/' ~/.ssh/config 

Try

ssh gw2hpcs04 

It will ask for your passphrase on the gateway hpcgw followed by your hpc-password on hpcs04 .

-- Rene Janssen - 2020-03-27

 
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