Raspberry Pi: activating and using SSH access

Raspberry Pi not only cuts a fine figure as an elementary hardware component of creative DIY projects. The British mini computer is also very much in demand for the operation of various types of servers (e.g. cloud, DNS, or Minecraft servers) due to its decent computing power and minimalist power consumption. Many users rely on remote access via SSH (secure shell) so that they do not always have to connect the keyboard and monitor when making changes to server configurations.

Setting up SSH on Raspberry Pi – starting position

If you run a server on Raspberry Pi, you will in most cases use Raspbian as the standard software foundation. The newer versions of the Linux distribution for the Pi have a SSH service (which is needed to establish encrypted remote connections) already installed by default. For security reasons, however, the service is no longer active from the outset, making it necessary to activate it first to take advantage of remote access. While Linux and macOS users can easily connect via SSH via the shell or terminal, Windows users need additional software such as PuTTY or WinSCP.


'Pi' is the default Raspbian profile, which always has the same password ('raspberry'). So, when the SSH service was enabled by default, any user who could connect to the Raspberry network could easily log on to it as long as the credentials were not changed. This is why SSH was disabled in the basic setup.

Tutorial: how to enable SSH on Raspberry Pi

SSH was deactivated by default to make external access harder. In order to avoid this risk when activating SSH manually, you should change the password for the 'Pi' user as soon as possible – and definitely before connecting to the internet.

There are four ways to enable SSH:

Solution 1: create ssh file in the boot directory on the SD card

If you don’t have the ability to operate Raspberry directly via keyboard and screen, you can use a simple trick instead: Use an external computer to access the microSD card on which you have installed Raspbian and then create a file called ssh in the boot directory. It’s important that you do not use a file extension in this case and make sure that it is not automatically added (this often happens with Windows). If you then reboot the mini computer, SSH access will be enabled.

Solution 2: enable SSH server via desktop

If you connect the mini computer to your keyboard, mouse, and monitor, you can also easily turn on SSH on your Raspberry Pi using the desktop interface. To do this, open the start menu and navigate to 'Raspberry Pi Configuration' via the menu entitled 'Preferences'. Under the item 'Interfaces', you will find, among other things, the corresponding entry for SSH including the default setting ('disabled = deactivated'), which you can reverse at this point. Then confirm the change by clicking on 'OK'.

Solution 3: enable SSH via terminal in raspi-config

If you have connected the keyboard and screen to your Raspberry, you can also enable SSH access via the terminal. To do this, start the command line and type the following command:

sudo raspi-config

In the menu of the opening configuration tool, first select item 7 ('Advanced options') and then select A4 ('SSH'). The tool asks you if you want to enable the SSH server, which you do, before closing the settings by clicking on 'Finish'.

Solution 4: start the SSH service with systemctl

As an alternative to raspi-config, you can use the systemctl command line tool to set up SSH on your Raspberry Pi. Simply enter the following two commands into the terminal:

sudo systemctl enable ssh
sudo systemctl start ssh

While the first command causes the SSH server to start automatically as soon as the mini computer is booted, the second command starts the server in the current session.

How to access the enabled Raspberry Pi SSH server

After you start the SSH service on your Raspberry Pi, the mini computer is ready for remote access via the network protocol. The further procedure differs depending on the type of operating system installed on the external computer. The following instructions show how Windows, Linux, and macOS users can handle the secure connection setup and what difficulties are to be expected.

How to set up an SSH connection to Raspberry Pi on Linux and macOS

macOS and Linux distributions such as Ubuntu or Debian automatically support connection setup via the SSH protocol – thanks to a standard implementation of the free software OpenSSH. You only have to make sure that the computer is on the same network as Raspberry Pi. If this is the case, you only need the IP address to initiate the connection setup. There are two ways to find out:

  1. Use the terminal of the mini computer and enter the command
hostname -I

if you operate Raspberry directly via keyboard and monitor.

  1. Look for the address in the device list on your router or use a tool such as Nmap on an external computer if you’re running Raspberry in ‘Headless’ mode.

Then try to establish the SSH connection via the Unix device’s terminal, with the corresponding command structured as follows:

ssh username@IPaddress

With the 'username' parameter, you can insert either the default profile 'pi' or the name of your own profile (if you’ve created one). The first time you establish the SSH connection between Pi and the external device, you will receive a security/authentication message. Once you’ve read this, enter 'yes' in the terminal to continue. Finally, enter the password for the selected user to connect to the Raspberry’s command line.


It is possible that Raspberry Pi has been assigned an IP address that the external computer has previously connected to (even if this happened in another network). If this is the case, you will receive a warning when the connection is established, including a request to delete the corresponding IP entry from the list of known devices. Follow the given instructions before executing the SSH command again.

How to set up SSH access on Windows with PuTTY

Unlike most Unix systems, Windows doesn’t have an SSH client by default. The first step is to download a corresponding application. We have chosen PuTTY, but there are many client programs that are very similar in terms of operation and functionality.

On the PuTTY project website, you can download either the installation package or the exe file of the program (putty.exe) directly. The latter eliminates the installation process so that PuTTY can be started immediately. Once you have started the client by double-clicking on it, all you have to do is enter the host name in the appropriate field and press the 'open' button.


In some cases, it might be necessary to specify the IP address instead of the host name. If you don’t know it, you can use the methods listed above (Nmap, router’s list of devices, terminal check).

PuTTY will now display a message asking you to confirm the trustworthiness of the Raspberry Pi SSH server and the SSH key, which you do by clicking on 'yes'. Just like with Unix, this security information only appears when you connect for the first time. A new window will open in which you can enter the login credentials for the remote login to the Raspberry terminal.


If a timeout occurs during the login attempt, it is highly likely that the IP address entered does not match the actual address of Raspberry Pi.

We use cookies on our website to provide you with the best possible user experience. By continuing to use our website or services, you agree to their use. More Information.