1

When I'm trying to copy a file using scp (in whatever direction), there's no error displayed (although the returned $? code is 1), all I can see is the message that normally the REMOTE machine prints when I log in (it's printed from the startup script). Nothing else is printed and the file isn't copied.

Local machine is OpenSUSE (never had any problems on that ground), remote machine is Centos 7, freshly installed.

The exactly same command executed on the CentOS machine, also in whatever direction, works without problems. It's simple like scp FILENAME sektor@remote-machine:.

Anyone has idea how to at least debug this or whatever other checks I could do to understand what happened?

I tried already -v, it prints nothing unusual. Since the moment of requesting the password it prints (I changed the machine name and IP):

debug1: Next authentication method: password
sektor@remote-machine's password: 
debug1: Authentication succeeded (password).
Authenticated to remote-machine ([1.2.3.4]:22).
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: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending command: scp -v -f FILENAME
Sink: Welcome to remote-machine, sektor. Put on the helmet, just in case.
Welcome to remote-machine, sektor. Put on the helmet, just in case.
Sending file modes: C0664 0 FILENAME
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 2576, received 2612 bytes, in 0.1 seconds
Bytes per second: sent 17661.7, received 17908.5
debug1: Exit status 1

The log suggests as if some copying happened, but still the file wasn't copied.

EDIT: Funny thing is, I have reinstalled a different system there (Oracle Linux this time) and after copying all my startup files I have again the same problem. But I found a "solution" (tho I'd call it workaround): I removed the last line of the subscript of .bashrc, which was doing, as you might have guessed:

echo "Welcome to $HOSTNAME, $LOGNAME. Put on the helmet, just in case"

Once removed, scp copies these files correctly. I am still curious, what the real root case was, though, because I have this line in the OpenSuSE system (15.1) and scp was always working without problems.

Ethouris
  • 111
  • 1
    Do you know what is producing the message "Welcome to remote-machine, sektor. Put on the helmet, just in case."? What shell are you using on the remote system? Have you added anything to your shell startup files on the remote system that interacts with the user or starts a different shell? – Kenster Nov 22 '23 at 17:06
  • Could the file be written to an unexpected location? – DrMoishe Pippik Nov 22 '23 at 17:22
  • @Kenster: This message is exactly the thing I mentioned in the beginning - it is printed by the bash startup script on the remote machine when you log in. It's in a sub-script of .bashrc. – Ethouris Nov 23 '23 at 07:32
  • @DrMoishePippik: I copy it to the home directory, just like the example command specifies it. – Ethouris Nov 23 '23 at 07:33
  • 1
    See this answer where it says "If this involves printing to stdout […] then the local scp will fail". – Kamil Maciorowski Nov 23 '23 at 21:07

0 Answers0