Share files between your phone and laptop

Student
Search for a command to run...

Student
No comments yet. Be the first to comment.
If you've ever faced the challenge of running graphical user interface (GUI) programs within a container, fear not! While it may seem like a daunting task at first, with this comprehensive guide, we'll walk through the process using Incus Container. ...

When working with containers, managing file sharing between the host system and container can often pose a challenge. However, there is an easy-to-use solution that simplifies this process using just one line of code! This blog post will guide you on...

Incus, a manager and hypervisor for system containers (LXC) and virtual machines (QEMU), is an excellent tool for managing and orchestrating your applications and services. It is a fork of LXD by the original maintainers. I found the documentation re...

Using ble.sh and Starship. Bash by itself is pretty basic. Syntax highlighting, auto-suggestion and history matching are pretty helpful features in any shell. Users might be worried about the bloat these features bring and add delay to the startup of...

The ability to run virtual machines (VMs) and docker containers is an integral part of today’s modern computing landscape. However, issues with internet connectivity inside these environments often cause significant inconvenience for users who depend...

Requirements:
Laptop: openssh, a file manager
Phone: Termux or an SSH server app, a file manager capable of connecting to a file server
Prerequisite: Both devices should be connected to the same network
Normally, a Linux distro comes with openssh pre-installed. If not, it should be available in your distro’s repository.
Have SSH server run at startup with (run as root)
systemctl enable sshd.service
systemctl start sshd.service
If you are one of those people who uses OpenRC, run (as root)
rc-update add sshd default
rc-service sshd start
If you do not fall in either category, then you probably know what to do.
The config file is /etc/ssh/sshd_config.
Now there are multiple ways to get SSH server on your phone. You can get one on Termux, or install one of the several apps on Play Store or F-Droid.
I personally use SSH/SFTP Server – Terminal (contains ads), it is good enough and just werks™. You set up a new username and password, select required directories and start. By default it listens on port 2222 .
If you are using Termux, you can install the openssh package and start with sshd. By default it listens on port 8022.
The config file is `$PREFIX/etc/ssh/sshd_config.
You can have sshd start on boot by configuring Termux:Boot.
Once you have got the server up and running, all that remains is you connect through SFTP and start transferring files. On your laptop, use a file manager that supports connecting through SFTP (nautilus, dolphin, etc.). You either type the address in the address bar or in a separate “Network Location” (depends on the file manager). Whatever the case, you enter your IP address with port (sftp://[YOUR IP ADDRESS]:[PORT]). It should ask for your username and password (for the machine you are trying to connect). Once you are connected, it should display your files. Now copy files and folders like you normally do.
On your phone, install a file manager that supports SFTP. I use Cx File Explorer. Go to Network > New location > Remote > SFTP. Enter username, password, address and port of your laptop and you should be good to go.
Alternatively, you can also use command line to transfer files using the tool sftp. You connect using sftp -P [port] [username]@[ip address]. This method works both on laptop and in Termux.
If you are entirely new to SSH, you should look into setting up a key pair for your devices. It is more secure than using your password.