1

I am trying to move a file from a virtual machine (Ubuntu 18.04) on my local system to a remote server using a very basic scp command. This issue is present only on one particular server, others work fine so it is not a generic thing.

scp <file name> <user>@<complete_hostname>:~/

But this command does not proceed beyond authentication which is successful.

Same happens when I use FileZilla.

The IT team advised me to use 'WinSCP' which works fine.

scp debug log

debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/username/.ssh/id_dsa
debug1: Trying private key: /home/username/.ssh/id_ecdsa
debug1: Next authentication method: password
'user'@'full hostname's password: 
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = C
debug1: Sending env LC_ALL = C
debug1: Sending command: scp -v -t ~/

There is no progress after this, FileZilla times out after 20 seconds in similar fashion. while WinSCP works fine.

What can cause scp to hang, as I am using this in some of my scripts, this issue with one particular server has made my scripts unusable on them, this applies to SFTP methods also.

The IT Team advised me to not use the flags -d and -t while issuing the command as the same shows up on the debug log and is not supported by the remote server. Can these be removed? I did not explicitly issue them with the command.

Edit 2:

SCP Log: (from local machine, Ubuntu 18.04)
==========
debug1: Next authentication method: publickey
debug1: Offering public key: 
RSA SHA256:<key> /home/username/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279 
debug1: Authentication succeeded (publickey).
Authenticated to 'HOSTNAME' ([10.6.26.145]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LANG = en_IN
debug1: Sending command: scp -v -r -d -t ~/received/
  • Please also add the error log from the server. The configuration of the sshd could also be helpful. – Gerald Schneider Aug 6 '18 at 6:53
  • 1
    Why are you asking about some "flags"? Why do you assume "flags" have anything to do with your problem? Do you see different "flags" on the other machines? Also note that FileZilla does not support SCP protocol, so your question is not really about SCP. – Martin Prikryl Aug 6 '18 at 7:23
  • @MartinPrikryl forgot to add that part to the question, I have added it now. – ArunMKumar Aug 6 '18 at 8:34
  • @GeraldSchneider could you please tell me how to do it? – ArunMKumar Aug 6 '18 at 8:38
  • Where do you see -d flag? – Martin Prikryl Aug 6 '18 at 8:45
1

The IT Team advised me to not use the flags -d and -t while issuing the command as the same shows up on the debug log and is not supported by the remote server. Can these be removed? I did not explicitly issue them with the command.

-t - That's a total nonsense. SCP protocol cannot work without the -t flag. See How is SCP (secure copy protocol) file transfer working?

-d - It's used, when you specify more than one source. It indicates to the server that the "target should be directory".

In both cases I doubt that the server does not support any of them. As it's Ubuntu, it's running OpenSSH with 99.9% certainty. And OpenSSH supports those flags ever since it exists. See scp.c from 1999.


I'm pretty sure that the advice you got is just a nonsense. The "IT team" probably just didn't found those switches in scp man page and got an easy way out of really helping you. But those flags are internal flags used for communicating between scp as a "client" and scp as a "server". They are not documented by purpose.

Also FileZilla does not even support SCP protocol. What only contributes to the above - Your problem has nothing to do with any "scp flags".

| improve this answer | |
  • The '-d' flag gets added depending upon the machine I try the scp command from, my local machine running ubuntu 18.04 adds a '-d' flag while another remote running RHEL6 does not. – ArunMKumar Aug 6 '18 at 9:58
  • See my updated answer. – Martin Prikryl Aug 6 '18 at 12:09
  • well, I contacted the 'IT Team' :P when I lost all options. Don't have many hopes from them anyway. any suggestions to find the cause myself. I do not have any form of elevated access on the remote. – ArunMKumar Aug 6 '18 at 16:13
  • Ask a new question about your real problem (hang/timeout), instead of asking about a purported solution (the flags). – Martin Prikryl Aug 6 '18 at 16:15
  • That was exactly my question, they asked for the logs and diverted the answer to 'non-supported flags'. – ArunMKumar Aug 6 '18 at 16:18
-1

This turns out to be a firewall blocking the transfer. Reason being the file permission on my default shell's .*rc file. .cshrc in this case.

My default shell is csh, and the File permission were

-rwxr-s---

Changing these to

-rw-r-----

solved the issue.

Thanks all for the help.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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