Problem
On my MacBook Pro running Mac OS 10.15.7, I cannot do outbound scp, sftp, or rsync to seemingly any server (I've tried ~10 I own). I also cannot run remote commands by ssh, e.g. ssh othermachine /bin/true
fails just like scp. However ssh othermachine
works as normal. This problem arose out of the blue last week after scp had worked flawlessly with these same machines for many years.
Tried So Far
- All other machines can still scp and sftp to and from each other, including to and from the same network my laptop is on. That seems to narrow the problem to with my laptop specifically and in particular eliminate network problems.
- This doesn't seem to be a problem with
~/.bashrc
or~/.profile
-- even entirely deleting those file on both machines changes nothing and the former already contains proper handling for non-interactive sessions. - sudo'ing scp fails just like if I run it as a normal user. Trying that also required using password authentication, so that seemingly rules out problems with
~/.ssh/authorized_keys
that I'm otherwise using for automatic login. - Different versions of ssh/scp/sftp fail the same. I've tried both the built-in version (OpenSSH_8.1p1, LibreSSL 2.7.3) and the latest from Homebrew (OpenSSH_9.4p1, OpenSSL 3.1.2 1 Aug 2023). In particular,
scp -O
on the newer version fails the same way.
Typical Outputs
I'll post typical outputs as I can. (SE claims they "[look] like spam" but I see everyone else is able to post them, so I must be doing something wrong!)
Last 20 lines from scp -vvv randomfile localserver:~:
debug1: Remote: Ignored authorized keys: bad ownership or modes for file /home/me/.ssh/authorized_keys
debug3: receive packet: type 4
debug1: Remote: /home/me/.ssh/authorized_keys2:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug3: receive packet: type 91
debug2: channel_input_open_confirmation: channel 0: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: set_sock_tos: set socket 3 IP_TOS 0x20
debug2: client_session2_setup: id 0
debug1: Sending subsystem: sftp
debug2: channel 0: request subsystem confirm 1
debug3: send packet: type 98
debug3: client_repledge: enter
debug1: pledge: fork
debug2: channel_input_open_confirmation: channel 0: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: send packet: type 1
client_loop: send disconnect: Broken pipe
scp: Connection closed
bad ownership or modes for file /home/me/.ssh/authorized_keys
would seem to be the issue - did you check and fix the owenership of said file?