202511051857 Status: idea Tags: SSH, linux

ssh file sharing

Preperation

openssh

To enable ssh file sharing, the host needs to have openssh-server installed and running on the host machine, the device you want to send the files to.

Installation:

sudo apt update
sudo apt install openssh-server -y

Check if running:

sudo systemctl status ssh

If it is not running, you can start it manually:

sudo systemctl start ssh
sudo systemctl enable ssh  # optional, starts on boot

fetching your IP

find your local ip (or public ip, that would in theory work the same, but this example assumes 2 devices on the same network)

ip a

this command will tell you a lot, look for the ip that looks something like 192.168.178.122. in general, 50% of that is the same for every device.

Usage

on the device that wants to share the files, run the following command:

scp -r <local-folder> <host-user>@<host-ip>:<folder-on-host>

Make sure to replace the following parts:

  • <local-folder> is the entire folder that you want to share, an example would be: /home/localuser/Downloads/folder1
  • <host-user> is the user on the host device. You can see this in your terminal when pressing ctrl + alt + t, then you’ll see something like this: localuser@localuser-PC:~$. then localuser is the host-user.
  • <host-ip> is the IP found at fetching your IP. if you are on a different network on each device, then you need to google how to do that.
  • <folder-on-host> is the folder where you want to put your files into, for example: /home/mainuser/backup/

and then it will ask for the password of the host user (the password the host uses to login and to use sudo). after you have done that, it will start to copy all your files.


References

I was trying to backup a lot of files before wiping a laptop and putting ubuntu on it.