J0nty
J0nty

Reputation: 9

Transfer files from remote server to local machine

How can i directly transfer files from remote host to local machine if i have only access to remote server? I have tried scp and tail over ssh from local machine but I have to transfer data from remote machine using remote server.

Upvotes: 0

Views: 944

Answers (2)

synacker
synacker

Reputation: 1782

You can try daggy.

Create sources config with files that you want to transfers and remote servers, from which you want to transfer (files.yaml):

    aliases:  
        - &my_commands
            file1:
                exec: cat file1
                extension: log
            file2:
                exec: cat file2
                extension: log
            
        - &ssh_auth
            user: {{env_USER}}
            passphrase: {{env_PASSWORD}}
                
    sources:
        localhost:
            type: local
            commands: *my_commands
        remotehost:
            host: 192.168.1.9
            type: ssh2
            parameters: *ssh_auth
            commands: *my_commands
        remotehost2:
            host: 192.168.1.10
            type: ssh2
            parameters: *ssh_auth
            commands: *my_commands

Run daggy:

    daggy files.yaml

Upvotes: 0

Subhashis Pandey
Subhashis Pandey

Reputation: 1538

You can use scp to transfer files from server to server, server to local machine and local machine to server. Use the following commands

scp [OPTION] [user@]SRC_HOST:]file1 [user@]DEST_HOST:]file2

For options check the manual here

Below is an example of downloading file from server to local machine

scp [email protected]:/var/www/html/foo.txt ~/Desktop/

Upvotes: 0

Related Questions