I have a strange situation where scp to a server fails but only when done with the root user. I don't understand what could be the reason. The file never exists on the target. Here is the command I ran on the same host, however it also fails from remote.

scp -vvv ./test.txt localhost:/home/benedict/test6.txt

Here is part of the debug once the authentication succeeds.

    debug1: Sending command: scp -v -t /home/benedict/test6.txt
debug2: channel 0: request exec confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
Agent pid 21657
debug2: channel 0: read<=0 rfd 4 len 0
debug2: channel 0: read failed
debug2: channel 0: close_read
debug2: channel 0: input open -> drain
debug2: channel 0: ibuf empty
debug2: channel 0: send eof
debug2: channel 0: input drain -> closed
host-001 20180731-08:05:37 ~
# debug2: channel 0: write failed
debug2: channel 0: close_write
debug2: channel 0: send eow
debug2: channel 0: output open -> closed
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd eof
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
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 fd -1/-1 cc -1)

debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
Transferred: sent 4224, received 3104 bytes, in 0.3 seconds
Bytes per second: sent 13181.0, received 9686.0
debug1: Exit status 0

closed as too broad by Ipor Sircer, schily, Thomas, slm Jul 31 '18 at 12:33

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    A related question is unix.stackexchange.com/questions/459017 . – JdeBP Jul 31 '18 at 8:40
  • Cheers, I will investigate that @JdeBP – Ben Jul 31 '18 at 13:38
  • @JdeBP you were correct, the bashrc file caused scp to break! Thanks a lot for the pointer, I will now look for why this happened. – Ben Jul 31 '18 at 15:54

Browse other questions tagged or ask your own question.