Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am trying to copy file from my server to another so I am using the following command:

scp root@myhost /home/direc/file.tar username@secondhost:/home/dir

I am getting the error:

ssh: connect to host secondhost port 22 connection timed out

I know it might be because port 22 is not open on second host

so How do I transfer by specifying port 21 on my second host

share|improve this question

1 Answer

up vote 1 down vote accepted

Try

scp -P 21 root@myhost /home/direc/file.tar username@secondhost:/home/dir

Where -P stands for port number.

share|improve this answer
I know this but it specifies the port for first host from where I want to copy files not the second host.So do I specify port 21 for second host – user1613566 Aug 31 '12 at 6:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.