Can't do an SCP pull despite SSH working fine
Clash Royale CLAN TAG#URR8PPP
I have setup key authentication between two servers and I can ssh in without a key, for example:
ssh backup@hostname
this works fine and logs me in.
But when I try an SCP to pull a file, I get no files.
The target files have chmod 777
done to them for troubleshooting purposes but it's like it just doesn't find any files to copy even though they are there.
Here is the (ip's obfuscated) output of
scp -vvv backup@hostname:/var/stuff/backups/*.tgz /data/backups/
from the point it authenticates onward.
debug1: Authentication succeeded (publickey).
Authenticated to xxx.xxx.xxx.xxx ([xxx.xxx.xxx.xxx]: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
debug1: Entering interactive session.
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: packet_set_tos: set IP_TOS 0x08
debug2: client_session2_setup: id 0
debug1: Sending environment.
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env TERM
debug3: Ignored env SHELL
debug3: Ignored env SSH_CLIENT
debug3: Ignored env SSH_TTY
debug3: Ignored env http_proxy
debug3: Ignored env USER
debug3: Ignored env LS_COLORS
debug3: Ignored env MAIL
debug3: Ignored env PATH
debug3: Ignored env QT_QPA_PLATFORMTHEME
debug3: Ignored env PWD
debug1: Sending env LANG = en_AU.UTF-8
debug2: channel 0: request env confirm 0
debug3: Ignored env SHLVL
debug3: Ignored env HOME
debug3: Ignored env LANGUAGE
debug3: Ignored env LOGNAME
debug3: Ignored env SSH_CONNECTION
debug3: Ignored env LESSOPEN
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env LESSCLOSE
debug3: Ignored env _
debug3: Ignored env OLDPWD
debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
debug2: channel 0: request exec confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 131072
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: rcvd close
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
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
debug1: fd 2 clearing O_NONBLOCK
Transferred: sent 3736, received 2280 bytes, in 0.0 seconds
Bytes per second: sent 764498.2, received 466556.7
debug1: Exit status 1
backup@ar-secubn03:/var/scripts$
linux ssh scp
add a comment |
I have setup key authentication between two servers and I can ssh in without a key, for example:
ssh backup@hostname
this works fine and logs me in.
But when I try an SCP to pull a file, I get no files.
The target files have chmod 777
done to them for troubleshooting purposes but it's like it just doesn't find any files to copy even though they are there.
Here is the (ip's obfuscated) output of
scp -vvv backup@hostname:/var/stuff/backups/*.tgz /data/backups/
from the point it authenticates onward.
debug1: Authentication succeeded (publickey).
Authenticated to xxx.xxx.xxx.xxx ([xxx.xxx.xxx.xxx]: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
debug1: Entering interactive session.
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: packet_set_tos: set IP_TOS 0x08
debug2: client_session2_setup: id 0
debug1: Sending environment.
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env TERM
debug3: Ignored env SHELL
debug3: Ignored env SSH_CLIENT
debug3: Ignored env SSH_TTY
debug3: Ignored env http_proxy
debug3: Ignored env USER
debug3: Ignored env LS_COLORS
debug3: Ignored env MAIL
debug3: Ignored env PATH
debug3: Ignored env QT_QPA_PLATFORMTHEME
debug3: Ignored env PWD
debug1: Sending env LANG = en_AU.UTF-8
debug2: channel 0: request env confirm 0
debug3: Ignored env SHLVL
debug3: Ignored env HOME
debug3: Ignored env LANGUAGE
debug3: Ignored env LOGNAME
debug3: Ignored env SSH_CONNECTION
debug3: Ignored env LESSOPEN
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env LESSCLOSE
debug3: Ignored env _
debug3: Ignored env OLDPWD
debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
debug2: channel 0: request exec confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 131072
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: rcvd close
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
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
debug1: fd 2 clearing O_NONBLOCK
Transferred: sent 3736, received 2280 bytes, in 0.0 seconds
Bytes per second: sent 764498.2, received 466556.7
debug1: Exit status 1
backup@ar-secubn03:/var/scripts$
linux ssh scp
1
@garethTheRed The debug output is fine.-f
is a purposefully undocumented option thatscp
(andrcp
before it) sends to its partnerscp
on the remote side to get it to behave as the remote side of the copy function. The problem in this case is something else.
– Celada
Mar 17 '15 at 7:21
the * is expanding on the local machine so it expands to what files match existing already on the local machine. see the answer by gogoud.
– Skaperen
Mar 17 '15 at 10:06
1
Doesssh backup@hostname "ls /var/stuff/backups/*.tgz"
output anything in addition to the list of files?
– Mark Plotnick
Mar 17 '15 at 16:16
add a comment |
I have setup key authentication between two servers and I can ssh in without a key, for example:
ssh backup@hostname
this works fine and logs me in.
But when I try an SCP to pull a file, I get no files.
The target files have chmod 777
done to them for troubleshooting purposes but it's like it just doesn't find any files to copy even though they are there.
Here is the (ip's obfuscated) output of
scp -vvv backup@hostname:/var/stuff/backups/*.tgz /data/backups/
from the point it authenticates onward.
debug1: Authentication succeeded (publickey).
Authenticated to xxx.xxx.xxx.xxx ([xxx.xxx.xxx.xxx]: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
debug1: Entering interactive session.
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: packet_set_tos: set IP_TOS 0x08
debug2: client_session2_setup: id 0
debug1: Sending environment.
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env TERM
debug3: Ignored env SHELL
debug3: Ignored env SSH_CLIENT
debug3: Ignored env SSH_TTY
debug3: Ignored env http_proxy
debug3: Ignored env USER
debug3: Ignored env LS_COLORS
debug3: Ignored env MAIL
debug3: Ignored env PATH
debug3: Ignored env QT_QPA_PLATFORMTHEME
debug3: Ignored env PWD
debug1: Sending env LANG = en_AU.UTF-8
debug2: channel 0: request env confirm 0
debug3: Ignored env SHLVL
debug3: Ignored env HOME
debug3: Ignored env LANGUAGE
debug3: Ignored env LOGNAME
debug3: Ignored env SSH_CONNECTION
debug3: Ignored env LESSOPEN
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env LESSCLOSE
debug3: Ignored env _
debug3: Ignored env OLDPWD
debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
debug2: channel 0: request exec confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 131072
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: rcvd close
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
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
debug1: fd 2 clearing O_NONBLOCK
Transferred: sent 3736, received 2280 bytes, in 0.0 seconds
Bytes per second: sent 764498.2, received 466556.7
debug1: Exit status 1
backup@ar-secubn03:/var/scripts$
linux ssh scp
I have setup key authentication between two servers and I can ssh in without a key, for example:
ssh backup@hostname
this works fine and logs me in.
But when I try an SCP to pull a file, I get no files.
The target files have chmod 777
done to them for troubleshooting purposes but it's like it just doesn't find any files to copy even though they are there.
Here is the (ip's obfuscated) output of
scp -vvv backup@hostname:/var/stuff/backups/*.tgz /data/backups/
from the point it authenticates onward.
debug1: Authentication succeeded (publickey).
Authenticated to xxx.xxx.xxx.xxx ([xxx.xxx.xxx.xxx]: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
debug1: Entering interactive session.
debug2: callback start
debug2: fd 3 setting TCP_NODELAY
debug3: packet_set_tos: set IP_TOS 0x08
debug2: client_session2_setup: id 0
debug1: Sending environment.
debug3: Ignored env XDG_SESSION_ID
debug3: Ignored env TERM
debug3: Ignored env SHELL
debug3: Ignored env SSH_CLIENT
debug3: Ignored env SSH_TTY
debug3: Ignored env http_proxy
debug3: Ignored env USER
debug3: Ignored env LS_COLORS
debug3: Ignored env MAIL
debug3: Ignored env PATH
debug3: Ignored env QT_QPA_PLATFORMTHEME
debug3: Ignored env PWD
debug1: Sending env LANG = en_AU.UTF-8
debug2: channel 0: request env confirm 0
debug3: Ignored env SHLVL
debug3: Ignored env HOME
debug3: Ignored env LANGUAGE
debug3: Ignored env LOGNAME
debug3: Ignored env SSH_CONNECTION
debug3: Ignored env LESSOPEN
debug3: Ignored env XDG_RUNTIME_DIR
debug3: Ignored env LESSCLOSE
debug3: Ignored env _
debug3: Ignored env OLDPWD
debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
debug2: channel 0: request exec confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 131072
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd eof
debug2: channel 0: output open -> drain
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: rcvd close
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
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
debug1: fd 2 clearing O_NONBLOCK
Transferred: sent 3736, received 2280 bytes, in 0.0 seconds
Bytes per second: sent 764498.2, received 466556.7
debug1: Exit status 1
backup@ar-secubn03:/var/scripts$
linux ssh scp
linux ssh scp
edited Mar 17 '15 at 7:32
user39428
30427
30427
asked Mar 17 '15 at 6:36
Steven Vernau
912
912
1
@garethTheRed The debug output is fine.-f
is a purposefully undocumented option thatscp
(andrcp
before it) sends to its partnerscp
on the remote side to get it to behave as the remote side of the copy function. The problem in this case is something else.
– Celada
Mar 17 '15 at 7:21
the * is expanding on the local machine so it expands to what files match existing already on the local machine. see the answer by gogoud.
– Skaperen
Mar 17 '15 at 10:06
1
Doesssh backup@hostname "ls /var/stuff/backups/*.tgz"
output anything in addition to the list of files?
– Mark Plotnick
Mar 17 '15 at 16:16
add a comment |
1
@garethTheRed The debug output is fine.-f
is a purposefully undocumented option thatscp
(andrcp
before it) sends to its partnerscp
on the remote side to get it to behave as the remote side of the copy function. The problem in this case is something else.
– Celada
Mar 17 '15 at 7:21
the * is expanding on the local machine so it expands to what files match existing already on the local machine. see the answer by gogoud.
– Skaperen
Mar 17 '15 at 10:06
1
Doesssh backup@hostname "ls /var/stuff/backups/*.tgz"
output anything in addition to the list of files?
– Mark Plotnick
Mar 17 '15 at 16:16
1
1
@garethTheRed The debug output is fine.
-f
is a purposefully undocumented option that scp
(and rcp
before it) sends to its partner scp
on the remote side to get it to behave as the remote side of the copy function. The problem in this case is something else.– Celada
Mar 17 '15 at 7:21
@garethTheRed The debug output is fine.
-f
is a purposefully undocumented option that scp
(and rcp
before it) sends to its partner scp
on the remote side to get it to behave as the remote side of the copy function. The problem in this case is something else.– Celada
Mar 17 '15 at 7:21
the * is expanding on the local machine so it expands to what files match existing already on the local machine. see the answer by gogoud.
– Skaperen
Mar 17 '15 at 10:06
the * is expanding on the local machine so it expands to what files match existing already on the local machine. see the answer by gogoud.
– Skaperen
Mar 17 '15 at 10:06
1
1
Does
ssh backup@hostname "ls /var/stuff/backups/*.tgz"
output anything in addition to the list of files?– Mark Plotnick
Mar 17 '15 at 16:16
Does
ssh backup@hostname "ls /var/stuff/backups/*.tgz"
output anything in addition to the list of files?– Mark Plotnick
Mar 17 '15 at 16:16
add a comment |
6 Answers
6
active
oldest
votes
Try this:
scp -vvv 'backup@hostname:/var/stuff/backups/*.tgz' /data/backups/
If that doesn't work try this:
scp -vvv 'backup@hostname:/var/stuff/backups/*.tgz' /data/backups/
This is generally good advice. But the debug output shows that the wildcard is being sent to the remote system unmolested:debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
– Kenster
Mar 18 '15 at 14:31
1
what are the permissions on/var/stuff/backups
(the directory) - does user backup have execute permission?
– gogoud
Mar 18 '15 at 14:51
add a comment |
debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
debug2: channel 0: request exec confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 131072
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
...
debug1: Exit status 1
These lines indicate that the local scp instance requested the expected scp
command to run on the remote system, and the remote server launched a process in response to the request. But the remote process exited with status code 1 almost immediately, and without emitting any output.
If the remote scp instance couldn't read the files to be copied, or if those files didn't exist, you would have gotten an error message to that effect. If the remote scp program couldn't be found or wasn't executable, then the exit code would have been 126 or 127 instead of 1.
I suspect one of these things is happening:
- Something in the remote account's .bashrc or .bash_profile is causing the shell to exit early. It may be sensitive to the fact the session doesn't have a TTY, for example.
- The
scp
program on the remote system is corrupt or malfunctioning. - The
scp
program on the remote system has been replaced with something else which isn't working like scp. Someone might have replaced it with a poorly written shell script, for example, or a copy of '/bin/false'. - The SSH software has been configured to block people from running scp. The key which you're using may be set in
authorized_keys
to run a specific command, or there may be aForceCommand
directive in the remote server'ssshd_config
file.
The simplest way to check these would be to ask the remote system administrator, or log into the remote system and inspect the scp executable. Running scp -h
will print an scp-specific usage message, for example.
If you have to troubleshoot this remotely, the next thing I'd try is something like this:
$ ssh -T backup@hostname cat /etc/group
This should write the remote system's group file to your terminal. This would prove that you can run arbitrary commands on the remote system.
$ ssh -T backup@hostname scp -v -f /etc/group < /dev/zero
This simulates the remote part of an scp
session. If the remote scp program is working, you should get output something like this:
C0644 674 group
root:x:0:
daemon:x:1:
[...]
devuser:x:1001:
Sending file modes: C0644 674 group
$
If all of that works, the question becomes why scp
fails for "/var/stuff/backups/*.tgz" but works for "/etc/group". You could run this to confirm whether it's working or not:
ssh -T backup@hostname 'scp -v -f /var/stuff/backups/*.tgz' < /dev/zero
If that continues to fail, the nuclear option would be to arrange to run the remote session under strace
and see exactly what each program is doing.
add a comment |
Your problem is clearly identified in these lines:
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd eof
which shows your channel is shut down as soon as it is opened, though the reason is not stated.
Normally,this occurs because of a faulty configuration in the /etc/passwd file, see for instance this Server Fault post. You may follow the suggestions in this post, or, better still, you may check the logs on the target machine,
tail /var/log/auth.log
for further details.
I checked and the user definitely has /bin/bash as shell in the passwd file so I don't think its that
– Steven Vernau
Mar 17 '15 at 23:31
add a comment |
I think you do 1st backups/* .tgz to change backups*.tgz
make sure don't use any space. might be 99% issue solved.
Nope tried that, doesnt work either :(
– Steven Vernau
Mar 17 '15 at 23:32
add a comment |
I had the same bad experience. I slight modification of the .bashrc on the remote system was the problem. I once added 'ulimit' and got the this problem during the next scp (ssh worked). After removing this line all was fine.
add a comment |
I was having a similar issue that I could exercise ssh
commands, but not scp
commands. I went through Kenster good debug techniques which still didn't get me anywhere, but very handy! I finally found out the issue was related to echo
commands in my .bashrc
script (after inserting additional ones). Once I commented out all the echo
commands in the script I was able to successfully execute the scp
command.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f190649%2fcant-do-an-scp-pull-despite-ssh-working-fine%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
6 Answers
6
active
oldest
votes
6 Answers
6
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try this:
scp -vvv 'backup@hostname:/var/stuff/backups/*.tgz' /data/backups/
If that doesn't work try this:
scp -vvv 'backup@hostname:/var/stuff/backups/*.tgz' /data/backups/
This is generally good advice. But the debug output shows that the wildcard is being sent to the remote system unmolested:debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
– Kenster
Mar 18 '15 at 14:31
1
what are the permissions on/var/stuff/backups
(the directory) - does user backup have execute permission?
– gogoud
Mar 18 '15 at 14:51
add a comment |
Try this:
scp -vvv 'backup@hostname:/var/stuff/backups/*.tgz' /data/backups/
If that doesn't work try this:
scp -vvv 'backup@hostname:/var/stuff/backups/*.tgz' /data/backups/
This is generally good advice. But the debug output shows that the wildcard is being sent to the remote system unmolested:debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
– Kenster
Mar 18 '15 at 14:31
1
what are the permissions on/var/stuff/backups
(the directory) - does user backup have execute permission?
– gogoud
Mar 18 '15 at 14:51
add a comment |
Try this:
scp -vvv 'backup@hostname:/var/stuff/backups/*.tgz' /data/backups/
If that doesn't work try this:
scp -vvv 'backup@hostname:/var/stuff/backups/*.tgz' /data/backups/
Try this:
scp -vvv 'backup@hostname:/var/stuff/backups/*.tgz' /data/backups/
If that doesn't work try this:
scp -vvv 'backup@hostname:/var/stuff/backups/*.tgz' /data/backups/
answered Mar 17 '15 at 7:59
gogoud
1,700716
1,700716
This is generally good advice. But the debug output shows that the wildcard is being sent to the remote system unmolested:debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
– Kenster
Mar 18 '15 at 14:31
1
what are the permissions on/var/stuff/backups
(the directory) - does user backup have execute permission?
– gogoud
Mar 18 '15 at 14:51
add a comment |
This is generally good advice. But the debug output shows that the wildcard is being sent to the remote system unmolested:debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
– Kenster
Mar 18 '15 at 14:31
1
what are the permissions on/var/stuff/backups
(the directory) - does user backup have execute permission?
– gogoud
Mar 18 '15 at 14:51
This is generally good advice. But the debug output shows that the wildcard is being sent to the remote system unmolested:
debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
– Kenster
Mar 18 '15 at 14:31
This is generally good advice. But the debug output shows that the wildcard is being sent to the remote system unmolested:
debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
– Kenster
Mar 18 '15 at 14:31
1
1
what are the permissions on
/var/stuff/backups
(the directory) - does user backup have execute permission?– gogoud
Mar 18 '15 at 14:51
what are the permissions on
/var/stuff/backups
(the directory) - does user backup have execute permission?– gogoud
Mar 18 '15 at 14:51
add a comment |
debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
debug2: channel 0: request exec confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 131072
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
...
debug1: Exit status 1
These lines indicate that the local scp instance requested the expected scp
command to run on the remote system, and the remote server launched a process in response to the request. But the remote process exited with status code 1 almost immediately, and without emitting any output.
If the remote scp instance couldn't read the files to be copied, or if those files didn't exist, you would have gotten an error message to that effect. If the remote scp program couldn't be found or wasn't executable, then the exit code would have been 126 or 127 instead of 1.
I suspect one of these things is happening:
- Something in the remote account's .bashrc or .bash_profile is causing the shell to exit early. It may be sensitive to the fact the session doesn't have a TTY, for example.
- The
scp
program on the remote system is corrupt or malfunctioning. - The
scp
program on the remote system has been replaced with something else which isn't working like scp. Someone might have replaced it with a poorly written shell script, for example, or a copy of '/bin/false'. - The SSH software has been configured to block people from running scp. The key which you're using may be set in
authorized_keys
to run a specific command, or there may be aForceCommand
directive in the remote server'ssshd_config
file.
The simplest way to check these would be to ask the remote system administrator, or log into the remote system and inspect the scp executable. Running scp -h
will print an scp-specific usage message, for example.
If you have to troubleshoot this remotely, the next thing I'd try is something like this:
$ ssh -T backup@hostname cat /etc/group
This should write the remote system's group file to your terminal. This would prove that you can run arbitrary commands on the remote system.
$ ssh -T backup@hostname scp -v -f /etc/group < /dev/zero
This simulates the remote part of an scp
session. If the remote scp program is working, you should get output something like this:
C0644 674 group
root:x:0:
daemon:x:1:
[...]
devuser:x:1001:
Sending file modes: C0644 674 group
$
If all of that works, the question becomes why scp
fails for "/var/stuff/backups/*.tgz" but works for "/etc/group". You could run this to confirm whether it's working or not:
ssh -T backup@hostname 'scp -v -f /var/stuff/backups/*.tgz' < /dev/zero
If that continues to fail, the nuclear option would be to arrange to run the remote session under strace
and see exactly what each program is doing.
add a comment |
debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
debug2: channel 0: request exec confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 131072
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
...
debug1: Exit status 1
These lines indicate that the local scp instance requested the expected scp
command to run on the remote system, and the remote server launched a process in response to the request. But the remote process exited with status code 1 almost immediately, and without emitting any output.
If the remote scp instance couldn't read the files to be copied, or if those files didn't exist, you would have gotten an error message to that effect. If the remote scp program couldn't be found or wasn't executable, then the exit code would have been 126 or 127 instead of 1.
I suspect one of these things is happening:
- Something in the remote account's .bashrc or .bash_profile is causing the shell to exit early. It may be sensitive to the fact the session doesn't have a TTY, for example.
- The
scp
program on the remote system is corrupt or malfunctioning. - The
scp
program on the remote system has been replaced with something else which isn't working like scp. Someone might have replaced it with a poorly written shell script, for example, or a copy of '/bin/false'. - The SSH software has been configured to block people from running scp. The key which you're using may be set in
authorized_keys
to run a specific command, or there may be aForceCommand
directive in the remote server'ssshd_config
file.
The simplest way to check these would be to ask the remote system administrator, or log into the remote system and inspect the scp executable. Running scp -h
will print an scp-specific usage message, for example.
If you have to troubleshoot this remotely, the next thing I'd try is something like this:
$ ssh -T backup@hostname cat /etc/group
This should write the remote system's group file to your terminal. This would prove that you can run arbitrary commands on the remote system.
$ ssh -T backup@hostname scp -v -f /etc/group < /dev/zero
This simulates the remote part of an scp
session. If the remote scp program is working, you should get output something like this:
C0644 674 group
root:x:0:
daemon:x:1:
[...]
devuser:x:1001:
Sending file modes: C0644 674 group
$
If all of that works, the question becomes why scp
fails for "/var/stuff/backups/*.tgz" but works for "/etc/group". You could run this to confirm whether it's working or not:
ssh -T backup@hostname 'scp -v -f /var/stuff/backups/*.tgz' < /dev/zero
If that continues to fail, the nuclear option would be to arrange to run the remote session under strace
and see exactly what each program is doing.
add a comment |
debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
debug2: channel 0: request exec confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 131072
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
...
debug1: Exit status 1
These lines indicate that the local scp instance requested the expected scp
command to run on the remote system, and the remote server launched a process in response to the request. But the remote process exited with status code 1 almost immediately, and without emitting any output.
If the remote scp instance couldn't read the files to be copied, or if those files didn't exist, you would have gotten an error message to that effect. If the remote scp program couldn't be found or wasn't executable, then the exit code would have been 126 or 127 instead of 1.
I suspect one of these things is happening:
- Something in the remote account's .bashrc or .bash_profile is causing the shell to exit early. It may be sensitive to the fact the session doesn't have a TTY, for example.
- The
scp
program on the remote system is corrupt or malfunctioning. - The
scp
program on the remote system has been replaced with something else which isn't working like scp. Someone might have replaced it with a poorly written shell script, for example, or a copy of '/bin/false'. - The SSH software has been configured to block people from running scp. The key which you're using may be set in
authorized_keys
to run a specific command, or there may be aForceCommand
directive in the remote server'ssshd_config
file.
The simplest way to check these would be to ask the remote system administrator, or log into the remote system and inspect the scp executable. Running scp -h
will print an scp-specific usage message, for example.
If you have to troubleshoot this remotely, the next thing I'd try is something like this:
$ ssh -T backup@hostname cat /etc/group
This should write the remote system's group file to your terminal. This would prove that you can run arbitrary commands on the remote system.
$ ssh -T backup@hostname scp -v -f /etc/group < /dev/zero
This simulates the remote part of an scp
session. If the remote scp program is working, you should get output something like this:
C0644 674 group
root:x:0:
daemon:x:1:
[...]
devuser:x:1001:
Sending file modes: C0644 674 group
$
If all of that works, the question becomes why scp
fails for "/var/stuff/backups/*.tgz" but works for "/etc/group". You could run this to confirm whether it's working or not:
ssh -T backup@hostname 'scp -v -f /var/stuff/backups/*.tgz' < /dev/zero
If that continues to fail, the nuclear option would be to arrange to run the remote session under strace
and see exactly what each program is doing.
debug1: Sending command: scp -v -f /var/stuff/backups/*.tgz
debug2: channel 0: request exec confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 131072
debug2: channel_input_status_confirm: type 99 id 0
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
...
debug1: Exit status 1
These lines indicate that the local scp instance requested the expected scp
command to run on the remote system, and the remote server launched a process in response to the request. But the remote process exited with status code 1 almost immediately, and without emitting any output.
If the remote scp instance couldn't read the files to be copied, or if those files didn't exist, you would have gotten an error message to that effect. If the remote scp program couldn't be found or wasn't executable, then the exit code would have been 126 or 127 instead of 1.
I suspect one of these things is happening:
- Something in the remote account's .bashrc or .bash_profile is causing the shell to exit early. It may be sensitive to the fact the session doesn't have a TTY, for example.
- The
scp
program on the remote system is corrupt or malfunctioning. - The
scp
program on the remote system has been replaced with something else which isn't working like scp. Someone might have replaced it with a poorly written shell script, for example, or a copy of '/bin/false'. - The SSH software has been configured to block people from running scp. The key which you're using may be set in
authorized_keys
to run a specific command, or there may be aForceCommand
directive in the remote server'ssshd_config
file.
The simplest way to check these would be to ask the remote system administrator, or log into the remote system and inspect the scp executable. Running scp -h
will print an scp-specific usage message, for example.
If you have to troubleshoot this remotely, the next thing I'd try is something like this:
$ ssh -T backup@hostname cat /etc/group
This should write the remote system's group file to your terminal. This would prove that you can run arbitrary commands on the remote system.
$ ssh -T backup@hostname scp -v -f /etc/group < /dev/zero
This simulates the remote part of an scp
session. If the remote scp program is working, you should get output something like this:
C0644 674 group
root:x:0:
daemon:x:1:
[...]
devuser:x:1001:
Sending file modes: C0644 674 group
$
If all of that works, the question becomes why scp
fails for "/var/stuff/backups/*.tgz" but works for "/etc/group". You could run this to confirm whether it's working or not:
ssh -T backup@hostname 'scp -v -f /var/stuff/backups/*.tgz' < /dev/zero
If that continues to fail, the nuclear option would be to arrange to run the remote session under strace
and see exactly what each program is doing.
answered Mar 18 '15 at 16:06
Kenster
1,4021611
1,4021611
add a comment |
add a comment |
Your problem is clearly identified in these lines:
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd eof
which shows your channel is shut down as soon as it is opened, though the reason is not stated.
Normally,this occurs because of a faulty configuration in the /etc/passwd file, see for instance this Server Fault post. You may follow the suggestions in this post, or, better still, you may check the logs on the target machine,
tail /var/log/auth.log
for further details.
I checked and the user definitely has /bin/bash as shell in the passwd file so I don't think its that
– Steven Vernau
Mar 17 '15 at 23:31
add a comment |
Your problem is clearly identified in these lines:
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd eof
which shows your channel is shut down as soon as it is opened, though the reason is not stated.
Normally,this occurs because of a faulty configuration in the /etc/passwd file, see for instance this Server Fault post. You may follow the suggestions in this post, or, better still, you may check the logs on the target machine,
tail /var/log/auth.log
for further details.
I checked and the user definitely has /bin/bash as shell in the passwd file so I don't think its that
– Steven Vernau
Mar 17 '15 at 23:31
add a comment |
Your problem is clearly identified in these lines:
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd eof
which shows your channel is shut down as soon as it is opened, though the reason is not stated.
Normally,this occurs because of a faulty configuration in the /etc/passwd file, see for instance this Server Fault post. You may follow the suggestions in this post, or, better still, you may check the logs on the target machine,
tail /var/log/auth.log
for further details.
Your problem is clearly identified in these lines:
debug2: exec request accepted on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug2: channel 0: rcvd eof
which shows your channel is shut down as soon as it is opened, though the reason is not stated.
Normally,this occurs because of a faulty configuration in the /etc/passwd file, see for instance this Server Fault post. You may follow the suggestions in this post, or, better still, you may check the logs on the target machine,
tail /var/log/auth.log
for further details.
edited Apr 13 '17 at 12:13
Community♦
1
1
answered Mar 17 '15 at 8:17
MariusMatutiae
3,38611325
3,38611325
I checked and the user definitely has /bin/bash as shell in the passwd file so I don't think its that
– Steven Vernau
Mar 17 '15 at 23:31
add a comment |
I checked and the user definitely has /bin/bash as shell in the passwd file so I don't think its that
– Steven Vernau
Mar 17 '15 at 23:31
I checked and the user definitely has /bin/bash as shell in the passwd file so I don't think its that
– Steven Vernau
Mar 17 '15 at 23:31
I checked and the user definitely has /bin/bash as shell in the passwd file so I don't think its that
– Steven Vernau
Mar 17 '15 at 23:31
add a comment |
I think you do 1st backups/* .tgz to change backups*.tgz
make sure don't use any space. might be 99% issue solved.
Nope tried that, doesnt work either :(
– Steven Vernau
Mar 17 '15 at 23:32
add a comment |
I think you do 1st backups/* .tgz to change backups*.tgz
make sure don't use any space. might be 99% issue solved.
Nope tried that, doesnt work either :(
– Steven Vernau
Mar 17 '15 at 23:32
add a comment |
I think you do 1st backups/* .tgz to change backups*.tgz
make sure don't use any space. might be 99% issue solved.
I think you do 1st backups/* .tgz to change backups*.tgz
make sure don't use any space. might be 99% issue solved.
answered Mar 17 '15 at 10:28
Inderpal Singh
11
11
Nope tried that, doesnt work either :(
– Steven Vernau
Mar 17 '15 at 23:32
add a comment |
Nope tried that, doesnt work either :(
– Steven Vernau
Mar 17 '15 at 23:32
Nope tried that, doesnt work either :(
– Steven Vernau
Mar 17 '15 at 23:32
Nope tried that, doesnt work either :(
– Steven Vernau
Mar 17 '15 at 23:32
add a comment |
I had the same bad experience. I slight modification of the .bashrc on the remote system was the problem. I once added 'ulimit' and got the this problem during the next scp (ssh worked). After removing this line all was fine.
add a comment |
I had the same bad experience. I slight modification of the .bashrc on the remote system was the problem. I once added 'ulimit' and got the this problem during the next scp (ssh worked). After removing this line all was fine.
add a comment |
I had the same bad experience. I slight modification of the .bashrc on the remote system was the problem. I once added 'ulimit' and got the this problem during the next scp (ssh worked). After removing this line all was fine.
I had the same bad experience. I slight modification of the .bashrc on the remote system was the problem. I once added 'ulimit' and got the this problem during the next scp (ssh worked). After removing this line all was fine.
edited Jun 14 '15 at 8:08
Anthon
60.2k17102163
60.2k17102163
answered Jun 14 '15 at 7:38
Rainer
1
1
add a comment |
add a comment |
I was having a similar issue that I could exercise ssh
commands, but not scp
commands. I went through Kenster good debug techniques which still didn't get me anywhere, but very handy! I finally found out the issue was related to echo
commands in my .bashrc
script (after inserting additional ones). Once I commented out all the echo
commands in the script I was able to successfully execute the scp
command.
add a comment |
I was having a similar issue that I could exercise ssh
commands, but not scp
commands. I went through Kenster good debug techniques which still didn't get me anywhere, but very handy! I finally found out the issue was related to echo
commands in my .bashrc
script (after inserting additional ones). Once I commented out all the echo
commands in the script I was able to successfully execute the scp
command.
add a comment |
I was having a similar issue that I could exercise ssh
commands, but not scp
commands. I went through Kenster good debug techniques which still didn't get me anywhere, but very handy! I finally found out the issue was related to echo
commands in my .bashrc
script (after inserting additional ones). Once I commented out all the echo
commands in the script I was able to successfully execute the scp
command.
I was having a similar issue that I could exercise ssh
commands, but not scp
commands. I went through Kenster good debug techniques which still didn't get me anywhere, but very handy! I finally found out the issue was related to echo
commands in my .bashrc
script (after inserting additional ones). Once I commented out all the echo
commands in the script I was able to successfully execute the scp
command.
answered Dec 21 '18 at 3:56
lordhog
148116
148116
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f190649%2fcant-do-an-scp-pull-despite-ssh-working-fine%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
@garethTheRed The debug output is fine.
-f
is a purposefully undocumented option thatscp
(andrcp
before it) sends to its partnerscp
on the remote side to get it to behave as the remote side of the copy function. The problem in this case is something else.– Celada
Mar 17 '15 at 7:21
the * is expanding on the local machine so it expands to what files match existing already on the local machine. see the answer by gogoud.
– Skaperen
Mar 17 '15 at 10:06
1
Does
ssh backup@hostname "ls /var/stuff/backups/*.tgz"
output anything in addition to the list of files?– Mark Plotnick
Mar 17 '15 at 16:16