User Tools

Site Tools


A PCRE internal error occured. This might be caused by a faulty plugin
tutorials:system:working_from_home

====== Working from home ====== The only machine you can connect to from the exterior is * bastion.inrialpes.fr - Montbonnot's access point At Inria, you need to properly set up your cryptographic key pair (public and private keys) as explained in the [[:new_arrivals_guide|New Arrivals Guide]]. More importantly, you need to copy your keys to your home machine's ~/.ssh directory. Avoid sending keys as an email attachment, copy them to a USB stick instead. If you have not set a password for your private key, anyone can use your account just by having the private key. Thus, **I strongly recommend that you set a password**. ===== Checking on experiments ===== After you've connected to pascal, you can jump to any other machine with a second SSH hop. To make checking on your experiments easier, run them inside "screen". Screen is a terminal emulator that you can attach/detach yourself from, and which stays alive even after you disconnect from a machine. The common use case is to run experiments at work inside screen. Back home, all you have to do is attach to the existing session. Running your first screen session is simple as pie: screen To kill your screen tab (and session), type "exit" and press Enter. The big problem with a default screen install is that it looks and behaves exactly the same as a regular terminal. If you want to change this, copy paste this into ~/.screenrc : <code> caption always caption string "%{kw}%-w%{wr}%n %t%{-}%+w" # Mouse scroll termcapinfo xterm* ti@:te@ </code> To use screen, you will need to know the essential hotkeys listed below.\\ All hotkey sequences begin with **Ctrl + A** and are followed by a second character.\\ The commands are case sensitive: * **c** : create tab * **n** : go to next tab * **p** : go to previous tab * **d** : detach from screen session * **A** : set tab title To check the currently running screen sessions: screen -list To attach to your opened screen session, here are two example commands: screen -rd # resume a detached screen session screen -rx # resume a screen session, detach it if necessary More hotkeys and options are available. Check screen's manual for more information: man screen ===== Graphical environment ===== ==== SSH X Forwarding ==== You can either forward X requests through SSH, which is slow and should only be used for lightweight applications such as a text editor: ssh -X -Y bastion.inrialpes.fr Note: all subsequent SSH hops need the -X -Y flags. ==== VNC ==== Another option is to use VNC, which will provide you with a full-blown remote desktop environment. [[tutorials:system:vnc_setup|VNC Setup]] ===== SSH Configuration ===== To make your life a little bit easier, it is possible to create a SSH configuration file that setup a connection to forwards all the input/output through bastion. You can do it by creating a file in //~/.ssh/config// containing: IdentityFile ~/.ssh/inria.pub Host bastion HostName bastion.inrialpes.fr ProxyCommand none ForwardX11 yes User username Host *.inrialpes.fr ProxyCommand ssh -W %h:22 bastion ForwardX11 yes User username Host yourmachine HostName yourmachine.inrialpes.fr User username ForwardX11 yes ProxyCommand ssh -W %h:22 bastion Host edgar HostName edgar.inrialpes.fr User username ForwardX11 yes ProxyCommand ssh -W %h:22 bastion You should change **~/.ssh/inria.pub** to the location of your public key, **username** to your Inria user and **yourmachine** to the name of the machine you want to access. You could also add as many host as you wish. This will allow you to connect to a machine without having to run ssh multiple times, e.g, if you want to connect to edgar, you could directly run: ssh edgar ===== Working with VS Code ===== [[https://code.visualstudio.com/|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 [[https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack|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 [[https://code.visualstudio.com/docs/remote/ssh|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 ===== [[https://jupyter.org/|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 ssh ''config'' 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!

tutorials/system/working_from_home.txt · Last modified: 2020/11/17 11:21 by azouaoui