Home > Back-end >  Sending files to SSH client over SSH using SCP
Sending files to SSH client over SSH using SCP

Time:08-19

The situation is that my client machine does not use static IP but the server machine is using static IP.

I connect to the server machine using ssh from the client machine.

Are there any easy ways to send files from the server machine to the client machine using scp or other commands?

CodePudding user response:

You can scp from the client machine and get the file from the server.

client$ scp user@server:< path to file > < path to destination folder in client >

eg, if you want file1 in the home directory from the server copied to the current directory in your client, you can do the following:

$ scp user@server:~/file1 .

ref: https://linuxize.com/post/how-to-use-scp-command-to-securely-transfer-files/

CodePudding user response:

If you don't really need to connect using the ssh command, you can connect using the sftp command (ftp-like interface through an ssh connection):

$ sftp user@server

And then just use the command get:

sftp> get <file>

Commands like ls, cd and pwd also work in this sftp interface.

  • Related