Home
build details

# 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

~/.ssh/config

Create the directory with the right permissions:

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

Edit the file:

~/.ssh/config

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

comment

laptop or duckiebot? - LP

HostKeyAlgorithms ssh-rsa

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

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 where: • 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:

Then:

Enter passphrase (empty for no passphrase):

Press enter; you want an empty passphrase.

Enter same passphrase again:

Press enter.

The key fingerprint is:
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

The file that contains the public key has extension .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). comment 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

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
warning
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: /home/local-user/.ssh/local-user@local.pub 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/*

## ssh-keygen

Modified 2018-06-22 by Andrea Censi

TODO: to write

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