I wrote this simple tutorial in case there are some Librem5 owners who are unaware of this capability (as I was), or who would like to see some practical examples of how to log in remotely to the L5 and/or copy files and folders over WiFi or shared ethernet. If anyone spots an error or wants to elaborate, please feel free to let me know. I’ll make corrections to the original post if necessary.
SECURE SHELL
Logging in remotely to the L5’s terminal
- On your computer (the client):
sudo apt update && sudo apt upgrade
sudo apt install openssh-client
- On the Librem 5 (the remote device):
sudo apt update && sudo apt upgrade
sudo apt install openssh-server
Confirm that it worked (i.e. is “active”):
sudo systemctl status ssh
If not active:
sudo systemctl enable ssh
If firewall blocks ssh on the remote device:
sudo ufw allow ssh
Other firewall options available:
stop
start
disable
- Determine IP address of the remote device (L5):
Available in the What IP
app, or via the L5’s terminal:
ip address
or ifconfig
or log in to your router to find the L5’s IP address.
- To log in over WiFi to the remote device (L5) from your computer:
ssh username@REMOTE.IP.ADDRESS.HERE
Example: ssh purism@192.168.1.xxx
Type the word “yes” at the next terminal question, then provide the password to your L5. The following prompt will appear:
purism@pureos:~$
You are now logged into your L5 from your computer’s terminal, and can easily execute any terminal commands remotely. This also makes it easy to copy terminal output and paste it here in the forum or elsewhere.
You can also connect your L5 to your computer over USB and use ssh
without WiFi. You will need to use your computer’s network settings to create a Shared Connection
over ethernet (not described here).
In the settings panel of the L5, under Sharing
, you should now see that Remote Login
is On
. At the top of this panel, you can use the toggle to disable or enable remote sharing as you wish.
- To exit
ssh
, use the commandexit
in the terminal.
SECURE COPY
- Now that
ssh
is enabled, you can use the Secure Copy command (scp
) to copy files or entire folders from the L5 to your computer, and vice versa. Note that in order to performscp
, you do not log in to the L5 viassh
first.
The syntax is:
scp remote_username@REMOTE.IP.ADDRESS.HERE:/remote/file.txt /local/directory
Examples:
scp purism@192.168.1.xxx:/home/purism/example.txt /home/yourusername/Desktop
would copy the file example.txt
located in the L5’s Home
folder to the desktop of your computer.
scp purism@192.168.1.xxx:/home/purism/Pictures/2021-04-12-example.png /home/yourusername/Desktop
would copy the image 2021-04-12-example.png
located in the L5’s Pictures
folder to the desktop of your computer.
- To copy an entire folder from the L5 to your computer:
scp -r purism@192.168.1.xxx:/home/purism/Pictures /home/yourusername/Desktop
will copy the folder “Pictures” from the L5 to your computer. (More convenient than copying individual images or files one at a time, in case there are many to copy.) The -r
after scp
stands for “recursive,” indicating that the copy action should continue until all is copied.
- To copy a file from your computer to the L5, the syntax is:
scp file.txt remote_username@REMOTE.IP.ADDRESS.HERE:/remote/directory
If the file is not located in your computer’s Home
directory, first change directory to the location of the file with the command cd
, for example cd Desktop
, if the file is on your desktop, and so on.
Example, from your home directory:
scp example.txt purism@192.168.1.xxx:
(Use the actual ip address of your L5. This places the file in the L5’s home directory.)
scp example.txt purism@192.168.1.xxx:/home/purism/Documents
(This goes to the L5’s Documents folder.)
- TIP: Although you perform
scp
without logging in to the other device withssh
, it may be helpful to usessh
first in order to list (ls
) the contents of a folder so that it will be easy to copy and paste the name of a file or files forscp
. Just be sure to exitssh
before you usescp
or you’ll get an error.
===================
I hope this helps other members here, especially those less experienced with the terminal.
EDIT: See important security considerations and recommendations in the comments below.