How to enable SSH (Secure Shell) on Raspberry?
Secure Shell, or better known as SSH, is a network protocol that runs on a computer. Raspberry Pi also offers this opportunity. By enabling the SSH service on it, it will be possible from any PC (even from mobile) that is connected to the network, access any Raspberry Pi and execute any command.
Note: Since November 2016, all versions of Raspbian show the SSH service disabled by default. This is to ensure the security of the operating system also for the profane.
There are several activation modes. Let’s see them together
Temporary SSH enabling
If you need to activate the SSH service only for an operation at the moment, you can launch the command:
sudo service ssh start
this command will launch the SSH service that will be disabled again to the next system reboot.
Permanent SSH enabling from command line
Launch raspi-config from command line by entering:
Once launched, raspi-config will appear on the end of a screen with various configuration options. Select Advanced Options.
When you press Enter, another screen will appear showing several options. Select the SSH option. Then select Yes to enable the service.
When the configuration is complete, you will be prompted to reboot the system to make the change effective.
Permanent SSH enabling from desktop
If you do not like consoles and shell commands, but love graphic environments and working with your mouse, Raspbian lets you enable SSH service even from desktop.
Select the Preferences > Raspberry Pi Configuration item from the menu
A valid shortcut
In addition to the methods seen above, there is also a fourth method. Indeed, the three previous methods provide for the possibility to access the Raspberry machine directly. Sometimes, however, this is not possible. Sometimes you have a Raspberry card without having a screen, a keyboard, and a mouse connected to it, but you just want to exploit Raspberry as a server to access remotely. And how to do this?
Well a trick is there.
Take the SD card on the Raspbian version you want to access.
Insert the SD card into a PC reader. Then access the board boot partition and create a file called simply ssh.
Here is enough. Remove the SD card from the PC, insert it again into Raspberry Pi and turn it on. Now Raspbian will start with the default SSH service.