I'd like to seek your help in finding the cause of this problem. I utilize SCP command to transfer files from one server to another. I utilize the return code that SCP return so as to verify if transfer is ok or not. Below is a sample code that I created.
if scp /some/folder/sample.txt <userName>@<ipAddress>:/some/remote/path/
then
echo "Successful"
else
echo "Failed"
fi
This code is ok with Linux, AIX and HP-UX and it always return "Successful". But I just observed that it does not hold true when I transfer the file to SunOS (SunOS 5.9). It always return "Failed" transaction. But the file was transferred successfully to the SunOS remote server.
BTW, my staging server is running on Linux. Thanks in advance.
$ scp -v sample.txt someuser@10.225.2.10:.
Executing: program /usr/bin/ssh host 10.225.2.10, user someuser, command scp -v -t .
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 10.225.2.10 [10.225.2.10] port 22.
debug1: Connection established.
debug1: identity file /home/someuser/.ssh/identity type -1
debug1: identity file /home/someuser/.ssh/id_rsa type 1
debug1: identity file /home/someuser/.ssh/id_dsa type -1
debug1: loaded 3 keys
debug1: Remote protocol version 2.0, remote software version Sun_SSH_1.0.1
debug1: match: Sun_SSH_1.0.1 pat Sun_SSH_1.0*
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: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host '10.225.2.10' is known and matches the RSA host key.
debug1: Found key in /home/someuser/.ssh/known_hosts:256
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
|-----------------------------------------------------------------|
| This system is for the use of authorized users only. |
| Individuals using this computer system without authority, or in |
| excess of their authority, are subject to having all of their |
| activities on this system monitored and recorded by system |
| personnel. |
| |
| In the course of monitoring individuals improperly using this |
| system, or in the course of system maintenance, the activities |
| of authorized users may also be monitored. |
| |
| Anyone using this system expressly consents to such monitoring |
| and is advised that if such monitoring reveals possible |
| evidence of criminal activity, system personnel may provide the |
evidence of such monitoring to law enforcement officials.