5

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.

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/


Form another  remote server:
debug1: Next authentication method: publickey
debug1: Trying private key: /home/username/.ssh/identity
debug1: Offering public key: /home/username/.ssh/id_rsa
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
username@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 ~/

I do not have any privileged access on these machines , is there a way to find out what is going wrong? What would I need to do the same?

ArunMKumar
  • 181
  • 2
  • 2
  • 9
  • is the server you are having issues with possibly loaded with high IO and/or CPU usage? Hanging sometimes means only "non-instant" action, which can happen for a lot of reasons (HDD is busy, no CPU cycles left, bad connection itself, delays or timeouts between auth and connecting (think f.e. firewall) – Dennis Nolte Aug 08 '18 at 09:09
  • Ask the sysadmin if sshd_config has UseDNS set to yes. Verify your VM can resolve in DNS if so. – Aaron Aug 08 '18 at 19:53
  • @DennisNolte thanks for directing to the Firewall, It was indeed the security software blocking it, The IT Team asked me to change the file permissions and it worked. – ArunMKumar Aug 09 '18 at 02:59

3 Answers3

2

For me, the directory I was scping to did not exist.

I was trying to send the file to C:\Users\MyUser\AppData\AnotherDir\AnotherDir\. Once I changed the target directory to the C:\Users\MyUser\, it worked.

Joshua Swain
  • 121
  • 3
1

For future readers,

# This will use port 2222
scp -v -P 2222 ~/local_file.txt admin@remote:~/dest

but

# This will use default port 22 and ignore your 2222
scp -v ~/local_file.txt -P 2222 admin@remote:~/dest

so scp could seem to hang this way (wrong port). The -v flag is your friend.

Drakes
  • 136
  • 5
0

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

My default shell is csh, and the File permission were

-rwxr-s---

Changing these to

-rw-r-----

solved the issue.

ArunMKumar
  • 181
  • 2
  • 2
  • 9