Connecting via SSH on Unix-like systems

In this recipe, we will connect to the Banana Pi using SSH on Linux or other Unix-like operating systems such as Mac OS X or FreeBSD. You probably have installed the required OpenSSH client already.

Getting ready

You will need the following ingredients to connect to your Banana Pi using SSH:

  • A booted up Linux operating system on your Banana Pi connected to your local network
  • A PC or Mac running a Unix-like operating system that has the OpenSSH client installed and is also connected to your local area network

How to do it…

To connect to your Banana Pi, you only need to perform the following steps:

  1. Open an arbitrary terminal program of your operating system.
  2. Type in the following ssh command into your shell:
    $ ssh -l bananapi 192.168.178.37
    

    Note

    In the previous command, we use the destination IP address of the Banana Pi, which we determined earlier. Indeed, you need the correct IP address or hostname of your Banana Pi.

  3. When trying to connect for the first time, you will be prompted to trust the yet unrecognized SSH server key at first. In this case, type yes to trust the server and hit Enter.
  4. You will be requested to enter the password of the user bananapi that is also bananapi by default.

Afterwards, you will see the shell of your Banana Pi on your terminal application.

The following screenshot shows an SSH login to the Banana Pi from a Linux PC running the xfce4-terminal terminal application:

How to do it…

How it works…

On most Unix-like systems, you are able to connect to remote SSH servers by default, as the required SSH client program is often already installed.

That program requires at least a destination IP address or hostname. We prepend the -l (login) parameter to choose a desired user for the login. If you do not enter a user to login, the local user that is currently trying to run the command will be chosen (rel in the previous screenshot).

As you can see in the previous screenshot, you can also shorten the command by typing the following command:

$ ssh username@host

There's more…

Most SSH client installations on Unix-like operating systems are able to read an optional configuration file to apply parameters to a desired host. If you append the following configuration to the file ~/.ssh/config (which will need to be created if not already existing), you can connect to your Banana Pi easily via ssh banana.

Host banana
    HostName 192.168.178.37
    User bananapi

As always, you need to replace the IP address after HostName with the correct IP address of the Banana Pi or the hostname. You can choose the name after Host (banana in the previous example) as you like. If you have more than one host configured, each name must be unique. Also, you can append a lot more parameters to the host configuration.

See also

  • The manual pages of the default SSH client on most Unix-like systems and its configuration:
    $ man ssh
    $ man ssh_config
    
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.204.247