Working from home¶
The only machine you can connect to from the exterior is
bastion.inrialpes.fr
- Montbonnot’s access point
You will need to use the access point as a proxy in order to access your inria workstation from your personal machine.
Generate SSH keys¶
On your personal machine:
ssh-keygen -f ~/.ssh/thoth
Important
Do not leave the passphrase field empty. You need to protect your private key with a password for security reasons.
This will generate a private key (~/.ssh/thoth
) and a public key (~/.ssh/thoth.pub
).
On your workstation at Inria, you need to place the public key previously generated under
/home/username/.ssh/thoth.pub
. To do so, you can send your public key to yourself via email or use an USB stick. If you are not physically at Inria, you can contact your system administrators to do it for you.Warning
Do not send the private key via email nor place it on an USB key ! This is not safe. Only your public key needs to be moved.
Then:
cat ~/.ssh/thoth.pub >> ~/.ssh/authorized_keys
At this point, you should be able to execute the following command on your personal machine to connect to bastion
.
ssh -i ~/.ssh/thoth <username>@bastion.inrialpes.fr
SSH configuration¶
You can use a ssh configuration file to make it easier for you.
To do so, create or update the file ~/.ssh/config
with the following lines on you personal machine:
Host bastion
HostName bastion.inrialpes.fr
User <username>
ProxyCommand none
IdentityFile ~/.ssh/thoth
Host *.inrialpes.fr
User <username>
ProxyCommand ssh -W %h:22 bastion
ForwardX11 yes
IdentityFile ~/.ssh/thoth
Host <workstation>
HostName <workstation>.inrialpes.fr
User <username>
ProxyCommand ssh -W %h:22 bastion
ForwardX11 yes
IdentityFile ~/.ssh/thoth
Host edgar
HostName edgar.inrialpes.fr
User <username>
ProxyCommand ssh -W %h:22 bastion
ForwardX11 yes
IdentityFile ~/.ssh/thoth
Replace the occurences of <username>
and <workstation>
with your inria username and workstation name.
You can remove ForwardX11*
lines if you do not need graphical interface.
Now you should be able to connect simply by typing : ssh <workstation>
, ssh edgar
or ssh bastion
.
Additional tools¶
SSH session¶
We recommend running an instance of tmux
or screen
on your workstation.
This will allow you to reconnect to your session if you are disconnected.
Working with VS Code¶
Visual Studio Code provides a very convenient extension to connect to a remote instance. You only need to:
Install VSCode on your laptop;
Setup the SSH keys and write the SSH configuration file, as explained in the above section;
Install this extension in your VSCode installation.
If you configured .ssh/config
file properly, you should be able to
connect directly to your machine by running the
Remote-SSH: Connect to Host
command from the command palette. Then,
you have a transparent access to your remote host. Very convenient if
you’re not into command line environments!
Things to note:
Full documentation here.
When installing extensions, they are either installed on your laptop or on the virtual machine; generally, VSCode figures out properly the most efficient option.
I did not find a way to use the extensions already installed on the machine, in the
~/.vscode/extensions
directory. VSCode will create a new directory,~/.vscode-server/extensions
. Except if you use very big extensions (and you use both~/.vscode
and~/.vscode-server
) this should not be an issue though. Intellicode + Python language server weight ~350MB.
Jupyter notebook¶
Workstation¶
Jupyter notebooks are a convenient tool to quickly get started on any project.
One use case when working from home comes down to launching a
jupyter notebook
or jupyter lab
instance on a remote server
located on INRIA’s network and interacting with it on your own laptop.
This can be achieved in four easy steps:
Log into the remote machine using
ssh <machine_name>
provided that<machine_name>
has been added to your sshconfig
file as described in the SSH configuration section above.On the remote machine, start your jupyter instance to run without a browser on a dedicated port:
jupyter [notebook|lab] --no-browser --port 1234
.jupyter
will return a bunch of URLs, for instance:http://localhost:1234/?token=12be9ed56aae2653e79521ca3c366c19c6e43698edc690qe
.Back to your laptop, create a
ssh
tunnel between your localhost and the remote server as follows:ssh -NL 1234:localhost:1234 <machine_name>
Open the URL in your browser and profit!
Cluster¶
On the cluster, the approach is similar:
Start a new job:
oarsub -I
(from edgar)On the cluster node, start a jupyter instance:
jupyter [notebook|lab] --no-browser --port 1234
Open another terminal, connect to your job :
oarsub -C <OAR_JOBID>
(from edgar) and runssh -NR 1234:localhost:1234 <workstation>
On your laptop:
ssh -NL 1234:localhost:1234 <workstation>
Open your browser on your laptop: http://localhost:1234: