SCP command hungs on machine


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SCP command hungs on machine
# 1  
Old 05-09-2011
SCP command hungs on machine

Hi Guru's

I have a script that touch a file call "ready2prepro" and copy this file over to a remote host. I am using following scp commands were all the variables are exported before I run the script.

Code:
 scp -p ready2prepro ${REMOTE_USER_NAME}@${REMOTE_HOST}:${REMOTE_DST_PATH}

This script creates the file "ready2prepro" and I checked the permission of the file which I set up to 777. Even I tried to run the command itself but it hungs....not even coming back to the promt and no error.

Can someone please help me to resolve this issue?
# 2  
Old 05-09-2011
You said you are running this from a script right?
You might want to escape @ as in
Code:
scp -p ready2prepro ${REMOTE_USER_NAME}\@${REMOTE_HOST}:${REMOTE_DST_PATH}

And make sure your destination is reachable. execute the script with set -x and see if all the variables are populated correctly.

regards,
Ahamed
# 3  
Old 05-09-2011
Thanks Ahamed, for your quick reply.

I have checked the variables by echo and they are valid. However you made a good point...I can not ping the host although the host is in /var/hosts. Could it be firewall related or public key related issue?

Any thought?
# 4  
Old 05-09-2011
That depends on many factors

1. may the destination machine is not up
2. interface may be down
3. required routes may not be present
4. firewall issue etc

so its obvious why scp is not working.

regards,
Ahamed
# 5  
Old 05-09-2011
Adding the -v (verbose mode) option to the scp command might help. It will cause a bit of debuging information to be written to the standard error which might give you a better idea of what is going on.

Running the command
Code:
ssh -v user@host date

is something I use when things seem not to be working. Ssh will go through the same authorisation process as scp and executing the date command on the far host is easy and quick.

If ping -c 1 host-name fails, then your problem isn't related to scp, but is a network issue. Possible problems are a bad entry in /etc/hosts (if it is used) or a bad DNS entry, or as you said something like a firewall blocking the traffic. If ping does work, then there still could be an issue with the remote host; I've had many instances where a machine could be pinged, but ssh/scp wasn't able to establish a TCP session.

Hope maybe these might help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Current shell session hungs when run another binary

Hi, I am on AIX 7.1 and when I try to login to my account and sudo to other generic account (mqm user) my ssh session just hungs. ================== $ id uid=16150(sxp) gid=179(rax) groups=1179(raxs) $ $ $ sudo su - mqm Password: -------- Changed username to: mqm -------- .... (1 Reply)
Discussion started by: bdpl
1 Replies

2. Shell Programming and Scripting

scp command

Hi, Is there any way by which scp shall not prompt for a password? When ever i fire scp command it should automatically move the files to the mentioned location without prompting for the password. Is it possible?:confused: (2 Replies)
Discussion started by: arijitsaha
2 Replies

3. UNIX for Dummies Questions & Answers

help with scp command

Can someone please help me with what is wrong with this command? scp oracle@hrkpd124:/u01/app/oracle/rdbms/admin/dpoo.html root@hrkpmgmt:/export my intention is to copy the file dopp.html from the server hrkpd124 to the server hrkpmgmt but i am getting the error... (3 Replies)
Discussion started by: dollypee
3 Replies

4. AIX

Able to scp/ssh to AIX 6.1 machine, unable to sftp to it

Hello, I am trying to figure out why I cannot sftp onto our aix6.1 machine. I can ssh/scp onto it, and sftp outbound seems to work properly, but I can't sftp onto it. # sftp aix61 Connecting to aix61... root@aix61's password: Connection closed # This machine appears to have the pware... (2 Replies)
Discussion started by: bstring
2 Replies

5. Shell Programming and Scripting

Need help in using scp command

Hi all, I want to copy files from unix server to another unix server with out any password. Can some one please explain me the steps involved in achieving this with the actual commands and the sequence of commands i details. I tried my luck ith below procedure but it was not working. #... (1 Reply)
Discussion started by: p2winzip
1 Replies

6. Shell Programming and Scripting

shell script to copy files frm a linux machine to a windows machine using SCP

I need a shell script to copy files frm a linux machine to a windows machine using SCP. The files keeps changing day-to-day. I have to copy the latest file to the windows machine frm the linux machine. for example :In Linux, On July 20, the file name will be 20.txt and it should be copied to... (3 Replies)
Discussion started by: nithin6034
3 Replies

7. UNIX Desktop Questions & Answers

scp command

if i use scp command to copy a file from one server another server it is asking password of the server from where the file being copied. i am automating some reports.. i need the file to be copied without asking the password. can any help me out??? thanks in advance, Arun Manas (1 Reply)
Discussion started by: arunmanas
1 Replies

8. Red Hat

To find the LATEST file from a dir on REMOTE machine and SCP to local machine?

Hi All, URGENT - Please help me form a scipt for this: I need the LATEST file from a dir on REMOTE machine to be SCP'd to a dir on local machine. (and I need to execute this from local server) I know that the below cmd is used to find the LATEST file from a dir. But this command is not... (3 Replies)
Discussion started by: me_ub
3 Replies

9. UNIX for Dummies Questions & Answers

SCP command

Hello, Let's say I have the command line: scp -r /home/Mohit/Switches mkakkar@softmon:/home/mkakkar/ If I put a "/" after the Switches such that I get: scp -r /home/Mohit/Switches/ mkakkar@softmon:/home/mkakkar/ How does the behaviour change? (1 Reply)
Discussion started by: mojoman
1 Replies

10. UNIX for Advanced & Expert Users

scp from user A in machine 1 to user B in machine 2

Hi all, would like to find out how can i scp a file from user A in one host to user B in another host? i know how to get it done if its from user A in machine 1 to user A in machine 2. 1)on machine 1, generate a key pair. put the private key in the .ssh directory. 2)put the public key in... (2 Replies)
Discussion started by: new2ss
2 Replies
Login or Register to Ask a Question