build details

Show: section status errors & todos local changes recent changes last change in-page changes feedback controls

Accessing computers using SSH

Modified 2018-06-22 by Andrea Censi

Andrea Censi

Local configuration

Modified 2018-06-30 by Andrea Censi

The SSH configuration as a client is in the file


Create the directory with the right permissions:

$ mkdir ~/.ssh
$ chmod 0700 ~/.ssh

Edit the file:


(We suggest you use VIM to edit files; see a tutorial here.)


laptop or duckiebot? - LP

Then add the following lines:

HostKeyAlgorithms ssh-rsa

The reason is that Paramiko, used by roslaunch, does not support the ECSDA keys.

How to login with SSH and a password

Modified 2018-06-22 by Andrea Censi

To log in to a remote computer remote with user remote-user, use:

$ ssh remote-user@remote

Creating an SSH keypair

Modified 2018-06-22 by Andrea Censi

This is a step that you will repeat twice: once on the Duckiebot, and once on your laptop.

The program will prompt you for the filename on which to save the file.

Use the convention

/home/username/.ssh/username@host name
/home/username/.ssh/username@host name.pub


  • username is the current user name that you are using (ubuntu or your chosen one);
  • host name is the name of the host (the Duckiebot or laptop);

An SSH key can be generated with the command:

$ ssh-keygen -h

The session output will look something like this:

Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa):

At this point, tell it to choose this file:

/home/username/.ssh/username@host name


Enter passphrase (empty for no passphrase):

Press enter; you want an empty passphrase.

Enter same passphrase again:

Press enter.

Your identification has been saved in /home/username/.ssh/username@host name
Your public key has been saved in /home/username/.ssh/username@host name.pub
The key fingerprint is:
XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX:XX username@host name
The key's randomart image is:
+--[ RSA 2048]----+
|            .    |
|       o   o  .  |
|      o = o  . o |
|       B . .  * o|
|        S o    O |
|         o o  . E|
|          o o  o |
|           o  +  |
|            .. . |

Note that the program created two files.

The file that contains the private key is

/home/username/.ssh/username@host name

The file that contains the public key has extension .pub:

/home/username/.ssh/username@host name.pub

Next, tell SSH that you want to use this key.

Make sure that the file ~/.ssh/config exists:

$ touch ~/.ssh/config

Add a line containing

IdentityFile ~/.ssh/PRIVATE_KEY_FILE

(using the filename for the private key).


make sure to include the full path to the file, not just the filename.

Check that the config file is correct:

$ cat ~/.ssh/config
IdentityFile ~/.ssh/PRIVATE_KEY_FILE

To copy the generated SSH key to the clipboard xclip can be used (Installation of xclip if necessary).

$ sudo apt-get install xclip
$ xclip -sel clip < ~/.ssh/username@host name.pub

How to login without a password

Modified 2018-06-24 by Andrea Censi

You have two computers, called “local” and “remote“, with users “local-user” and “remote-user“. Here, we assume that local and remote are complete hostnames (such as duckiebot.local.).

The two computers are on the same network and they can ping each other.

You have created a keypair for local-user on local. This procedure is described in (unknown ref software_reference/howto-create-key-pair)

warning next (1 of 3) index
I will ignore this because it is an external link. 

 > I do not know what is indicated by the link '#software_reference/howto-create-key-pair'.

Location not known more precisely.

Created by function check_if_any_href_is_invalid in module mcdp_docs.check_missing_links.

From the local computer, local-user will be able to log in to remote computer without a password.

First, connect the two computers to the same network, and make sure that you can ping remote from local:

local $ ping remote.local

Do not continue if you cannot do this successfully.

If you have created a keypair for local-user, you will have a public key in this file on the local computer:


This file is in the form:

ssh-rsa long list of letters and numbers local-user@local

You will have to copy the contents of this file on the remote computer, to tell it that this key is authorized.

On the local computer, run the command:

local $ ssh-copy-id remote-user@remote

now you should be able to login to the remote without a password:

local $ ssh remote-user@remote

This should succeed, and you should not be asked for a password.

Fixing SSH Permissions

Modified 2018-06-22 by Andrea Censi

Sometimes, SSH does not work because you have the wrong permissions on some files.

In doubt, these lines fix the permissions for your .ssh directory.

$ chmod 0700 ~/.ssh
$ chmod 0700 ~/.ssh/*


Modified 2018-06-22 by Andrea Censi

TODO: to write

Because of mathjax bug

No questions found. You can ask a question on the website.