Cannot SFTP & SCP to IPFire

Help! As of yesterday I can connect via SSH but I cannot SFTP and cannot SCP. I’m not sure what changed.

Here is how things are setup for SSH Access:

I’ve turned off IPS, firewall rules, URL filter. I’ve rebooted IPFire and my Mac multiple times. And this same things happens on other Macs. I searched thru the various logs but haven’t found anything.

This is what I see on the client side when running scp:

iMac3:~ jcmurphy$ scp -rv -P 222 root@192.168.60.1:/var/log /Users/jcmurphy/Desktop
Executing: program /usr/bin/ssh host 192.168.60.1, user root, command scp -v -r -f /var/log
OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to 192.168.60.1 [192.168.60.1] port 222.
debug1: Connection established.
debug1: identity file /Users/jcmurphy/.ssh/id_rsa type 0
debug1: identity file /Users/jcmurphy/.ssh/id_rsa-cert type -1
debug1: identity file /Users/jcmurphy/.ssh/id_dsa type -1
debug1: identity file /Users/jcmurphy/.ssh/id_dsa-cert type -1
debug1: identity file /Users/jcmurphy/.ssh/id_ecdsa type -1
debug1: identity file /Users/jcmurphy/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/jcmurphy/.ssh/id_ed25519 type -1
debug1: identity file /Users/jcmurphy/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/jcmurphy/.ssh/id_xmss type -1
debug1: identity file /Users/jcmurphy/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.1
debug1: match: OpenSSH_8.1 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.60.1:222 as 'root'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
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
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:/3dv+D52VRCPV56z7GgOq5QqO5i13mrk
debug1: Host '[192.168.60.1]:222' is known and matches the ECDSA host key.
debug1: Found key in /Users/jcmurphy/.ssh/known_hosts:14
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: Will attempt key: /Users/jcmurphy/.ssh/id_rsa RSA SHA256:EoeUZKmR8ZxF0uGWE0/02huK4rWw4
debug1: Will attempt key: /Users/jcmurphy/.ssh/id_dsa 
debug1: Will attempt key: /Users/jcmurphy/.ssh/id_ecdsa 
debug1: Will attempt key: /Users/jcmurphy/.ssh/id_ed25519 
debug1: Will attempt key: /Users/jcmurphy/.ssh/id_xmss 
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>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/jcmurphy/.ssh/id_rsa RSA SHA256:EoeUZKmR8ZxinGWE0/02huK4rWw4
debug1: Server accepts key: /Users/jcmurphy/.ssh/id_rsa RSA SHA256:EoeUZKmR8ZrhnGWE0/02huK4rWw4
debug1: Authentication succeeded (publickey).
Authenticated to 192.168.60.1 ([192.168.60.1]:222).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Remote: /root/.ssh/authorized_keys:4: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Remote: /root/.ssh/authorized_keys:4: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending command: scp -v -r -f /var/log
protocol error: unexpected <newline>
iMac3:~ jcmurphy$ Entering directory: D0755 0 log
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 2912, received 2576 bytes, in 0.1 seconds
Bytes per second: sent 51934.2, received 45941.8
debug1: Exit status 1

And I see this on the IPFire side:

Mar  8 12:14:27 ipfire sshd[10669]: Accepted publickey for root from 192.168.60.109 port 50147 ssh2: RSA SHA256:EoeUZKmpfJ62in9]: Received disconnect from 192.168.60.109 port 50147:11: disconnected by user
Mar  8 12:14:27 ipfire sshd[10669]: Disconnected from user root 192.168.60.109 port 50147

SFTP seems like it is “authenticating” forever. SCP seems like it connects and disconnects instantly.

What am I missing?!?

Jon …

The first box “SSH Access” needs to be checked (in your screenshot).

I did the very same command and had no issues.

Yes. SSH works fine.

iMac3:~ jcmurphy$ ssh -p '222' root@192.168.60.1
Last login: Sun Mar  8 12:07:32 2020 from 192.168.60.109
. . .
The date now is Sun 08 Mar 2020 01:42:49 PM CDT
[root@ipfire ~]# 
[root@ipfire ~]# 
[root@ipfire ~]# ls -al /var/log
total 37992
drwxr-xr-x 16 root     root        4096 Mar  8 00:01 .
drwxr-xr-x 16 root     root        4096 Jan 11 16:03 ..
-rw-rw-r--  1 root     syslogd        0 Mar  8 00:01 bootlog
-rw-r--r--  1 root     root       12319 Mar  7 21:31 bootlog.1.gz
. . .

Do you have echo lines in your .bashrc ?

1 Like

Excellent thought! I did change my .bashrc on the March 6 and added a printf to print the date (see last line below). Why would an echo (or printf) mess this up?

[root@ipfire ~]# cat .bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
	. /etc/bashrc
fi

# Automatically logout only console users after 10 minutes.
export TMOUT=0
if [ -z "${SSH_TTY}" ] && [ -z "${STY}" ]; then
	export TMOUT=600
fi

# added by JCM
alias hs='history | grep -i'
alias sfind='sudo find / -iname'
printf "\nThe date now is %s\n" "$(date)"
[root@ipfire ~]# 

 

EDIT: That was it! You are a genius! I would have never found this. Thank you!