1

I have a raspberry pi zero v1 and a raspberry pi model 3 B+. The second one has some testing files i want to transfer to the first one.

Right now i’m ssh’ed into both raspberry pi’s (I’ll call them rp’s for short). Rp Zero v1 doesn’t have Wi-Fi capabilities so I’m connected to the internet through the USB port in my PC, so i have accessed it via:

SSH pi@raspberrypi.local

And I’ve accessed the second one via:

SSH pi@<ip address>

Normally i use:

Scp <file> <path in original directory> <user I want to transfer to>:<path I want to transfer to> 

To copy files from my pc to an rp, but I’m not sure what the user i want to transfer to is. I have tried

Scp <file> <original path> pi@raspberrypi.local:<destination path> 

And

Scp <file> <original path> pi@<ip address>:<destination path> 

Where <ip address> is what I obtained from running the command:

Hostname -I 

On the rp zero v1.

Neither of these work and I think I may be missing some conceptual understanding of how the rp zero v1 is connected to the internet. I would appreciate some guidance to understand that as well as how to transfer files without having to first transfer something to my computer.

Bodo
  • 283
  • 1
  • 8

2 Answers2

1

Instead of using ssh, use sftp. Here's how it looks from the terminal:

pi@raspberrypi3b:~ $ sftp pi@raspberrypi0w.local
The authenticity of host 'raspberrypi0w.local (192.168.1.51)' can't be established.
ECDSA key fingerprint is SHA256:AuR********************w9YDcZ0bijTO17zbeqvM.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'raspberrypi0w.local,192.168.1.51' (ECDSA) to the list of known hosts.
pi@raspberrypi0w.local's password:
Connected to raspberrypi0w.local.
sftp> ?
Available commands:
bye                                Quit sftp
cd path                            Change remote directory to 'path'
chgrp [-h] grp path                Change group of file 'path' to 'grp'
chmod [-h] mode path               Change permissions of file 'path' to 'mode'
chown [-h] own path                Change owner of file 'path' to 'own'
df [-hi] [path]                    Display statistics for current directory or
                                   filesystem containing 'path'
exit                               Quit sftp
get [-afpR] remote [local]         Download file
help                               Display this help text
lcd path                           Change local directory to 'path'
lls [ls-options [path]]            Display local directory listing
lmkdir path                        Create local directory
ln [-s] oldpath newpath            Link remote file (-s for symlink)
lpwd                               Print local working directory
ls [-1afhlnrSt] [path]             Display remote directory listing
lumask umask                       Set local umask to 'umask'
mkdir path                         Create remote directory
progress                           Toggle display of progress meter
put [-afpR] local [remote]         Upload file
pwd                                Display remote working directory
quit                               Quit sftp
reget [-fpR] remote [local]        Resume download file
rename oldpath newpath             Rename remote file
reput [-fpR] local [remote]        Resume upload file
rm path                            Delete remote file
rmdir path                         Remove remote directory
symlink oldpath newpath            Symlink remote file
version                            Show SFTP version
!command                           Execute 'command' in local shell
!                                  Escape to local shell
?                                  Synonym for help
sftp>

Once you get the sftp> prompt, type the ? character to get a list of the commands & brief description of their meaning. The get & put commands perform the actual file transfers. See man sftp for more details; exit closes the connection.

And if you want to use SSH key authentication instead of passwords, follow this guide to generate your public-private key pair & transfer the public key to the pi zero.

Seamus
  • 23,558
  • 5
  • 42
  • 83
0

If you are using internet connection sharing on the PC you can't.

You can turn ICS off (which will stop internet access) but then can ssh.

Incidentally ftp is a far easier way to transfer files and most PC have ftp clients.

Milliways
  • 62,573
  • 32
  • 113
  • 225