Friday, July 29, 2016

scp usage syntax


scp from one linux server to another:

[bear-xxx-xxx:/auto/tftp-sanity-testbed-infra]>scp -v ./UIHC_Fix.bin root@9.27.15.121:/root/UIHC/UIHC_Fix.bin
Executing: program /usr/bin/ssh host 9.27.15.121, user root, command scp -v -t /root/UIHC/UIHC_Fix.bin
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /users/srikragh/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 9.27.15.121 [9.27.15.121] port 22.
debug1: Connection established.
debug1: identity file /users/srikragh/.ssh/identity type -1
debug1: identity file /users/srikragh/.ssh/id_dsa type -1
debug1: identity file /users/srikragh/.ssh/id_rsa type 1
debug1: loaded 3 keys
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.4
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.4 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '9.27.15.121' is known and matches the RSA host key.
debug1: Found key in /users/srikragh/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /users/srikragh/.ssh/identity
debug1: Trying private key: /users/srikragh/.ssh/id_dsa
debug1: Offering public key: /users/srikragh/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending command: scp -v -t /root/UIHC/UIHC_Fix.bin
Sending file modes: C0777 497607048 UIHC_Fix.bin
Sink: C0777 497607048 UIHC_Fix.bin
UIHC_Fix.bin                                                                             81%  385MB   7.4MB/s   00:12 ETA



############################################################################

###########  Change "\" to "/" in the windows path  ###############

Original windows path: C:\Users\admin\Desktop\POLARIS\UIHC

To be used windows path in scp command: C:/Users/admin/Desktop/POLARIS/UIHC/UIHC_Fix.bin

##########################################################################


bgl-ads-843:26> scp -v ./UIHC_Fix.bin admin@10.104.99.167:C:/Users/admin/Desktop/POLARIS/UIHC/UIHC_Fix.bin
Executing: program /usr/bin/ssh host 10.104.99.167, user admin, command scp -v -t C:/Users/admin/Desktop/POLARIS/UIHC/UIHC_Fix.bin
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /users/srikragh/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 10.104.99.167 [10.104.99.167] port 22.
debug1: Connection established.
debug1: identity file /users/srikragh/.ssh/identity type -1
debug1: identity file /users/srikragh/.ssh/id_dsa type -1
debug1: identity file /users/srikragh/.ssh/id_rsa type 1
debug1: loaded 3 keys
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.9
debug1: match: OpenSSH_6.9 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host '10.104.99.167' is known and matches the RSA host key.
debug1: Found key in /users/srikragh/.ssh/known_hosts:29
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /users/srikragh/.ssh/identity
debug1: Trying private key: /users/srikragh/.ssh/id_dsa
debug1: Offering public key: /users/srikragh/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
admin@10.104.99.167's password: 
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Sending command: scp -v -t C:/Users/admin/Desktop/POLARIS/UIHC/UIHC_Fix.bin
Sending file modes: C0777 497607048 UIHC_Fix.bin
Sink: C0777 497607048 UIHC_Fix.bin
UIHC_Fix.bin                                                                            100%  475MB  33.9MB/s   00:14    
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 14.3 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 0
bgl-ads-843:27> 

###############################################################################

scp from cisco switch to linux machine:

CAT4k-SUP8E#copy scp: bootflash: vrf mgmtVrf 
Address or name of remote host [9.27.15.121]? 
Source username [root]? 
Source filename [/root/UIHC/UIHC_Fix.bin]? 
Destination filename [UIHC_Fix.bin]? 
Password: 
 Sending file modes: C0777 497607048 UIHC_Fix.bin
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

#########################################################################

scp from linux machine to cisco switch:
[Entered enable password = "cisco" to start file transfer when prompted to enter password]

root@FR-121:~/UIHC# scp -v ./UIHC_Fix.bin client1@9.27.156.11:UIHC_Fix.bin
Executing: program /usr/bin/ssh host 9.27.156.11, user client1, command scp -v -t -- UIHC_Fix.bin
OpenSSH_5.9p1 Debian-5ubuntu1.4, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 9.27.156.11 [9.27.156.11] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version Cisco-1.25
debug1: no match: Cisco-1.25
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.4
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<2048<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: RSA a6:a0:b7:3b:73:1f:6f:9a:68:8c:81:61:fb:2b:eb:fa
debug1: Host '9.27.156.11' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:15
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
C
***************************************************************************
WARNING
This resource is for use by authorized University of Iowa Hospitals and
Clinics users only. Individuals using or attempting to use this resource
without proper authorization are subject to criminal and civil prosecution.
Access to this resource is monitored and recorded.
***************************************************************************
debug1: Authentications that can continue: publickey,keyboard-interactive,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey,keyboard-interactive,password
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Next authentication method: keyboard-interactive
Password:
C Your failed attempt has been recorded.
debug1: Authentications that can continue: publickey,keyboard-interactive,password
Password:
debug1: Authentication succeeded (keyboard-interactive).
Authenticated to 9.27.156.11 ([9.27.156.11]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_IN
debug1: Sending command: scp -v -t -- UIHC_Fix.bin
Sending file modes: C0777 497607048 UIHC_Fix.bin
UIHC_Fix.bin                                                                              2%   10MB 307.5KB/s   25:47 ETA