LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-14-2020, 07:49 PM   #1
MasterPO
LQ Newbie
 
Registered: Dec 2009
Location: Omaha, Nebraska
Distribution: RedHat/CentOS/Fedora, Ubuntu, Mint
Posts: 7

Rep: Reputation: 0
scp drops connection after sending the scp -t command


I'm using Ubuntu 18.04.4
openssh-server Version: 1:7.6p1-4ubuntu0.3
as the destination host.

Raspian 4.19.97+
openssh-client version 1:7.9p1-10+
on the destination host.

command on the Pi is:
scp -vvv filename paul@destination:filename

The debug shows this:
debug1: Sending command: scp -v -t filename^M
debug2: channel 0: request exec confirm 1^M
debug3: send packet: type 98^M
debug2: channel_input_open_confirmation: channel 0: callback done^M
debug2: channel 0: open confirm rwindow 0 rmax 32768^M
debug2: channel 0: rcvd adjust 2097152^M
debug3: receive packet: type 99^M
debug2: channel_input_status_confirm: type 99 id 0^M
debug2: exec request accepted on channel 0^M
debug3: receive packet: type 96^M
debug2: channel 0: rcvd eof^M
debug2: channel 0: output open -> drain^M
debug2: channel 0: obuf empty^M
debug2: channel 0: chan_shutdown_write (i0 o1 sock -1 wfd 5 efd 6 [write])^M
lost connection


The destination shows that the client dropped the connection.

ssh works fine.

What am I missing?
 
Old 03-14-2020, 08:21 PM   #2
uteck
Senior Member
 
Registered: Oct 2003
Location: Elgin,IL,USA
Distribution: Ubuntu based stuff for the most part
Posts: 1,172

Rep: Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501Reputation: 501
I found some posts that indicate that one of these shell profile configs: .bashrc .bash_profile .profile .login, has a line that just says "exit 0" which causes the shell to exit over ssh/scp.

Also check to make sure the user does have access to use ssh on the remote server.
 
Old 03-14-2020, 08:50 PM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,725

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
I don’t find a -t option for scp. What does the man page on the client machine say about that.
Also, what’s in the ssh_config on the client?
 
Old 03-14-2020, 10:53 PM   #4
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,294
Blog Entries: 3

Rep: Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719
The -t option is the wrong one. It is not for you:

Code:
$ grep -B8 -A6 -E "case 't'" scp.c 
                /* Server options. */
                case 'd':
                        targetshouldbedirectory = 1;
                        break;
                case 'f':       /* "from" */
                        iamremote = 1;
                        fflag = 1;
                        break;
                case 't':       /* "to" */
                        iamremote = 1;
                        tflag = 1;
#ifdef HAVE_CYGWIN
                        setmode(0, O_BINARY);
#endif
                        break;
You probably meant to use a different option. What were you intending to do?
 
1 members found this post helpful.
Old 03-15-2020, 01:24 AM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,294
Blog Entries: 3

Rep: Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719Reputation: 3719
MasterPO, what does /var/log/auth.log say on the remote machine as the connection fails?

Code:
tail -f /var/log/auth.log | awk '$5~/^sshd/'
 
Old 03-15-2020, 03:39 PM   #6
MasterPO
LQ Newbie
 
Registered: Dec 2009
Location: Omaha, Nebraska
Distribution: RedHat/CentOS/Fedora, Ubuntu, Mint
Posts: 7

Original Poster
Rep: Reputation: 0
scp is sending the scp -t command to the remote host

Quote:
Originally Posted by scasey View Post
I don’t find a -t option for scp. What does the man page on the client machine say about that.
Also, what’s in the ssh_config on the client?
Please see the first line in the debug output:
debug1: Sending command: scp -v -t filename

That is the scp local sending the command to the remote.
I don't see where that is specified or changed anywhere.
 
Old 03-15-2020, 03:42 PM   #7
MasterPO
LQ Newbie
 
Registered: Dec 2009
Location: Omaha, Nebraska
Distribution: RedHat/CentOS/Fedora, Ubuntu, Mint
Posts: 7

Original Poster
Rep: Reputation: 0
Disconnected by user

Quote:
Originally Posted by Turbocapitalist View Post
MasterPO, what does /var/log/auth.log say on the remote machine as the connection fails?

Code:
tail -f /var/log/auth.log | awk '$5~/^sshd/'

The destination server syslog shows:
sshd[24607]: Received disconnect from 192.168.53.66 port 48438:11: disconnected by user
 
Old 03-15-2020, 03:46 PM   #8
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,725

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by MasterPO View Post
Please see the first line in the debug output:
debug1: Sending command: scp -v -t filename

That is the scp local sending the command to the remote.
I don't see where that is specified or changed anywhere.
Yes. I see that now. You're not specifying -t, but it's getting sent anyway.

An alias, perhaps?
what does which scp show?
Is there anything apparently relevant in the ssh_config?
 
Old 03-15-2020, 04:01 PM   #9
MasterPO
LQ Newbie
 
Registered: Dec 2009
Location: Omaha, Nebraska
Distribution: RedHat/CentOS/Fedora, Ubuntu, Mint
Posts: 7

Original Poster
Rep: Reputation: 0
The command I execute is:
scp -vvv 20200313182355 paul@hp-desktopieye-pic 2> scp-debug ; echo $?

The full debug is as follows:
Executing: program /usr/bin/ssh host hp-desktop, user paul, command scp -v -t pieye-pic
OpenSSH_7.9p1 Raspbian-10+deb10u2, OpenSSL 1.1.1d 10 Sep 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving "hp-desktop" port 22
debug2: ssh_connect_direct
debug1: Connecting to hp-desktop [192.168.53.8] port 22.
debug1: Connection established.
debug1: identity file /home/pi/.ssh/id_rsa type 0
debug1: identity file /home/pi/.ssh/id_rsa-cert type -1
debug1: identity file /home/pi/.ssh/id_dsa type -1
debug1: identity file /home/pi/.ssh/id_dsa-cert type -1
debug1: identity file /home/pi/.ssh/id_ecdsa type -1
debug1: identity file /home/pi/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/pi/.ssh/id_ed25519 type -1
debug1: identity file /home/pi/.ssh/id_ed25519-cert type -1
debug1: identity file /home/pi/.ssh/id_xmss type -1
debug1: identity file /home/pi/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9p1 Raspbian-10+deb10u2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.6p1 Ubuntu-4ubuntu0.3
debug1: match: OpenSSH_7.6p1 Ubuntu-4ubuntu0.3 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7 .7* compat 0x04000002
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to hp-desktop:22 as 'paul'
debug3: hostkeys_foreach: reading file "/home/pi/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/pi/.ssh/known_hosts:4
debug3: load_hostkeys: loaded 1 keys from hp-desktop
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh...01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: ecdsa-sha2-nistp256-cert-v01@openssh...01@openssh.com,ssh-ed25519,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128...cm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128...cm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm...28@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm...28@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: ssh-rsa,rsa-sha2-512,rsa-sha2-256,ecdsa-sha2-nistp256,ssh-ed25519
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128...cm@openssh.com
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128...cm@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm...28@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm...28@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:HCgaXqYydiyxxd6OzJUQ+D9XdxqoDRWsoqjAmmAIOmQ
debug3: hostkeys_foreach: reading file "/home/pi/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/pi/.ssh/known_hosts:4
debug3: load_hostkeys: loaded 1 keys from hp-desktop
debug3: hostkeys_foreach: reading file "/home/pi/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/pi/.ssh/known_hosts:3
debug3: load_hostkeys: loaded 1 keys from 192.168.53.8
debug1: Host 'hp-desktop' is known and matches the ECDSA host key.
debug1: Found key in /home/pi/.ssh/known_hosts:4
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug1: Will attempt key: /home/pi/.ssh/id_rsa RSA SHA256:iY07a4o6DeA/6+NFQX7O69NpIieoncQPweMFJdr8kx4
debug1: Will attempt key: /home/pi/.ssh/id_dsa
debug1: Will attempt key: /home/pi/.ssh/id_ecdsa
debug1: Will attempt key: /home/pi/.ssh/id_ed25519
debug1: Will attempt key: /home/pi/.ssh/id_xmss
debug2: pubkey_prepare: done
debug3: send packet: type 5
debug3: receive packet: type 7
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521>
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password
debug3: start over, passed a different list publickey,password
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/pi/.ssh/id_rsa RSA SHA256:iY07a4o6DeA/6+NFQX7O69NpIieoncQPweMFJdr8kx4
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 60
debug1: Server accepts key: /home/pi/.ssh/id_rsa RSA SHA256:iY07a4o6DeA/6+NFQX7O69NpIieoncQPweMFJdr8kx4
debug3: sign_and_send_pubkey: RSA SHA256:iY07a4o6DeA/6+NFQX7O69NpIieoncQPweMFJdr8kx4
debug3: sign_and_send_pubkey: signing using rsa-sha2-512
debug3: send packet: type 50
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).
Authenticated to hp-desktop ([192.168.53.8]:22).
debug2: fd 4 setting O_NONBLOCK
debug2: fd 5 setting O_NONBLOCK
debug2: fd 6 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug3: send packet: type 90
debug1: Requesting no-more-sessions@openssh.com
debug3: send packet: type 80
debug1: Entering interactive session.
debug1: pledge: network
debug3: receive packet: type 80
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: ssh_packet_set_tos: set IP_TOS 0x08
debug2: client_session2_setup: id 0
debug1: Sending command: scp -v -t pieye-pic
debug2: channel 0: request exec confirm 1
debug3: send packet: type 98
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug3: receive packet: type 99
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug3: receive packet: type 96
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: chan_shutdown_write (i0 o1 sock -1 wfd 5 efd 6 [write])
lost connection
debug2: channel 0: output drain -> closed
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug3: receive packet: type 98
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug2: channel 0: rcvd eow
debug2: channel 0: chan_shutdown_read (i0 o3 sock -1 wfd 4 efd 6 [write])
debug2: channel 0: input open -> closed
debug3: receive packet: type 97
debug2: channel 0: rcvd close
debug3: channel 0: will not send data after close
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug3: send packet: type 97
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
#0 client-session (t4 r0 i3/0 o3/0 e[write]/0 fd -1/-1/6 sock -1 cc -1)

debug3: send packet: type 1
debug1: fd 0 clearing O_NONBLOCK
debug3: fd 1 is not O_NONBLOCK
debug1: fd 2 clearing O_NONBLOCK
Transferred: sent 2716, received 2572 bytes, in 0.1 seconds
Bytes per second: sent 37976.3, received 35962.8
debug1: Exit status 0
 
Old 03-15-2020, 04:04 PM   #10
MasterPO
LQ Newbie
 
Registered: Dec 2009
Location: Omaha, Nebraska
Distribution: RedHat/CentOS/Fedora, Ubuntu, Mint
Posts: 7

Original Poster
Rep: Reputation: 0
ssh_config is:

# This is the ssh client system-wide configuration file. See
# ssh_config(5) for more information. This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
# 1. command line options
# 2. user-specific file
# 3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options. For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

Host 192.168.53.*
# ForwardAgent no
# ForwardX11 no
# ForwardX11Trusted yes
# PasswordAuthentication yes
# HostbasedAuthentication no
# GSSAPIAuthentication no
# GSSAPIDelegateCredentials no
# GSSAPIKeyExchange no
# GSSAPITrustDNS no
# BatchMode no
# CheckHostIP yes
# AddressFamily any
# ConnectTimeout 0
# StrictHostKeyChecking ask
# IdentityFile ~/.ssh/id_rsa
# IdentityFile ~/.ssh/id_dsa
# IdentityFile ~/.ssh/id_ecdsa
# IdentityFile ~/.ssh/id_ed25519
# Port 22
# Protocol 2
# Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
# MACs hmac-md5,hmac-sha1,umac-64@openssh.com
# EscapeChar ~
# Tunnel no
# TunnelDevice any:any
# PermitLocalCommand no
# VisualHostKey no
# ProxyCommand ssh -q -W %h:%p gateway.example.com
# RekeyLimit 1G 1h
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
 
Old 03-15-2020, 04:09 PM   #11
MasterPO
LQ Newbie
 
Registered: Dec 2009
Location: Omaha, Nebraska
Distribution: RedHat/CentOS/Fedora, Ubuntu, Mint
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by scasey View Post
Yes. I see that now. You're not specifying -t, but it's getting sent anyway.

An alias, perhaps?
what does which scp show?
Is there anything apparently relevant in the ssh_config?

which scp shows:

/usr/bin/scp


file /usr/bin/scp
/usr/bin/scp: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 3.2.0, BuildID[sha1]=af64bd71121b592e33132d0cf88e3fd38199f3c5, stripped
 
Old 03-15-2020, 04:35 PM   #12
MasterPO
LQ Newbie
 
Registered: Dec 2009
Location: Omaha, Nebraska
Distribution: RedHat/CentOS/Fedora, Ubuntu, Mint
Posts: 7

Original Poster
Rep: Reputation: 0
Oddly enough, if I pull a file from the destination - it works.

If I push from the desktop to the pi, it works.

It only fails pushing from the pi to the desktop
 
Old 03-15-2020, 04:49 PM   #13
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,725

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
ssh/scp/sftp isn't a two-way connection.
If you connect from the desktop to the pi, you can push or pull (get or put) from the desktop.
You can't originate anything on the pi unless you connect from the pi to the desktop first.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to use the screen command on Linux to keep your remote task running when the connection drops LXer Syndicated Linux News 0 01-06-2020 01:02 AM
PPPoE connection drops after 3 echo request failed and does not comes up. nitinsawade Linux - Networking 2 03-10-2014 01:32 AM
[SOLVED] SFTP ls drops connection from cron, but not from command line gjbloom Red Hat 2 08-06-2012 09:41 AM
network drops connection after physical move of server cornelius.conboy Linux - Networking 3 08-22-2011 02:14 PM
Wireless connection drops after few minutes jeffpr Linux - Wireless Networking 2 07-10-2005 08:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration