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 [email protected]

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> [email protected]:<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.

2
  • Scp usage: scp [options] [local path] [remote path] The local path is just a normal path, don't use something like me@here:/foobar. The remote path requires the remote user name (same as their login) and the hostname or IP: me@there:/absolute/path. If it does not work, scp -v will output some debugging information, scp -vv more. Edit it in the output from the latter with the exact command you are using and be aware of man scp.
    – goldilocks
    Commented Mar 26, 2022 at 19:47
  • You wrote "Neither of these work". How exactly does it not work? Do you get an error message? Then, please, copy&paste the exact command and the error message to your question. Or do you get a result different from what you expect? Then show/describe the actual and expected result in your question. edit your question to provide these details. Note that the ssh and scp commands are normally written with lowercase letters. On Windows it may be case-insensitive, but not on Linux.
    – Bodo
    Commented Mar 28, 2022 at 12:58

2 Answers 2

1

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

pi@raspberrypi3b:~ $ sftp [email protected]
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.
[email protected]'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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.