If your Raspberry is connected to a network there are two basic ways to remotely interact with it: SSH and SSHFS.
In this post I will describe each and when to use them.
SSH stands for Secure Shell and it is a network protocol that lets one create a shell session remotely.
This protocol is used whenever you need to control your Raspberry from your computer (or the other way around).
In order to enable SSH on your Raspberry, just open the terminal and:
$ sudo raspi-config
And you will be present with the following screens:
With SSH enabled, the command syntax is quite simple:
$ ssh [user]@[ip]
[user] is your remote username (Raspberry’s default is pi);
[ip] is your remote IP (use ipconfig command on your Raspberry terminal to know it’s IP).
In case you need to launch any program with a graphical interface here is what you should do:
$ ssh -X [user]@[ip]
For more details use:
$ man ssh
SSHFS stands for SSH File System and it is a file system that lets one mount a remote directory over an SSH connection.
SSHFS is a great way to share a folder between your computer and your Raspberry.
To mount a Raspberry folder on your computer, you need to install SSHFS Server on your Raspberry using the following terminal command:
$ sudo apt-get install openpssh-server
Then, on you computer create a folder and mount your Raspberry directory on it:
$ mkdir [comp_folder] $ sshfs [user]@[ip]:[pi_folder] [comp_folder]
[user] is your remote username;
[ip] is your remote IP;
[pi_folder] is the path of the Raspberry directory you want to mount;
[comp_folder] is the path to the folder you just created to mount your Raspberry.
As an example:
$ mkdir my_raspbian $ sshfs pi@[ip]:/home/pi my_raspbian
To unmount your folder just use the following terminal command on your computer:
$ fusermount -u [comp_folder]