other:ssh
This is an old revision of the document!
Table of Contents
Understanding and using ssh correctly
Everything you always wanted to know about ssh, ssh keys, the passphrase and ssh agent, but were afraid to ask
At least everything you need to know, without getting bored to death
A quick introduction
ssh
is a program for logging securely into a remote machine and for executing commands on a remote machine- More precisely
ssh
is an SSH client using the SSH protocol
- We assume below that you have a
my_login
account on the remoteremote_server
computer, and you know your password- This page will also show some examples using the LSCE and IPSL (ciclad) servers
- Instead of a password, you can also use a set of private and public keys and a passphrase
- Many programs are said to work over ssh when they implicitly use the ssh protocol to securely transfer their data from one server to another:
scp
(copy remote directories and files),rsync
(synchronize remote directories and files), …
- Some history: before you were born, and the world and internet were a safer place, people used less secure programs like
telnet
,rlogin
,rsh
,ftp
, …
Using ssh
On a Linux computer
Note: the following can also work in a terminal on a Mac or on a Windows 10 computer (ssh
is directly available in any Windows Powershell
, Windows Terminal
or the old cmd
, but it is not the best way to use ssh
on Windows)
ssh [options] [my_login@]remote_server
- If your login is the same on the local and remote computer, you can omit the optional
my_login@
: e.g. just usessh ssh1.lsce.ipsl.fr
- Most common options:
-X
: Enable X11 forwarding. This option will allow you to start graphical programs on the remote server- If
-X
does not work, use-Y
instead (Enable trusted X11 forwarding) - Using this option will automatically define the
DISPLAY
environment variable that is required by graphical programs. Otherwise, DISPLAY will not be defined
jypeter@lsce5203:~$ echo $DISPLAY localhost:0.0 jypeter@lsce5203:~$ ssh ssh1.lsce.ipsl.fr Last login: Wed Jul 8 14:45:31 2020 from 176-142-31-75.abo.bbox.fr [jypeter@ssh1 ~]$ echo $DISPLAY DISPLAY: Undefined variable. [jypeter@ssh1 ~]$ logout Connection to ssh1.lsce.ipsl.fr closed. jypeter@lsce5203:~$ ssh -X ssh1.lsce.ipsl.fr [jypeter@ssh1 ~]$ echo $DISPLAY localhost:43.0
- In order to display graphical windows, you also need to have a local X server running!
- Windows: install, configure and launch VcXsrv
-A
: enable agent forwarding. This is useful when you use ssh keys, and an ssh agent-t command
: this option allows you to execute a command on the remote server (without displaying the output of the initial ssh). We use it mostly to chain ssh connections, when we have to go through a specific server to access another one
e.g.-v
: verbose mode. Use this only option when you can't connect, or things don't seem to work correctly. Analyzing the verbose output when you startssh
should allow you, or the system administrators, to find out what is wrong
aliases
.ssh/
A recommended ssh client for Windows
Just transferring files
Using ssh keys
Using an ssh agent
More...
- If you want to know more (options, etc…), check the man(ual) page on Linux:
man ssh
- emacs
[ PMIP3 Wiki Home ] - [ Help! ] - [ Wiki syntax ]
other/ssh.1594224225.txt.gz · Last modified: 2020/07/08 18:03 by jypeter