SCP command not found

General support questions
c9dy
Posts: 4
Joined: 2020/04/29 18:04:17

SCP command not found

Post by c9dy » 2020/04/29 18:19:16

Have a slight issue in that I cant scp from a centos6 server to a cent os 7 server (and vice versa)

Get the error on either server

Code: Select all

-bash: scp -p6336: command not found
Command im using is

Code: Select all

scp -p6336 myfile.text root@newserersvip:/directoryonnewserver/
port 6336 is ssh this has been changed and works fine

running CFS firewall and posts open and its whitelisted

openssh clients installed on both servers

I can ssh to either server in terminal......

Tried quite a few things and at a loss so any help appreciated

scottro
Forum Moderator
Posts: 2456
Joined: 2007/09/03 21:18:09
Location: NYC
Contact:

Re: SCP command not found

Post by scottro » 2020/04/30 09:32:05

Though not an answer, please note that with scp (as opposed to ssh) it should be -P, not -p for port number, e.g., scp -P 7777 file1 server2:


Also, doing (on CentOS-8)

Code: Select all

dnf provides scp 
shows that it requires ssh-clients, though I suspect that's a default package with install.
New users should check the FAQ and Read Me First pages

c9dy
Posts: 4
Joined: 2020/04/29 18:04:17

Re: SCP command not found

Post by c9dy » 2020/04/30 15:30:47

Sorry the -p was a -P typo here

User avatar
TrevorH
Forum Moderator
Posts: 29171
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: SCP command not found

Post by TrevorH » 2020/04/30 15:50:15

-bash: scp -p6336: command not found
I'm going to go with: that's not a space between scp and -p so it's treating the whole thing as one string and searching for a command called "scp -p6336".
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

User avatar
jlehtone
Posts: 2940
Joined: 2007/12/11 08:17:33
Location: Finland

Re: SCP command not found

Post by jlehtone » 2020/04/30 22:11:35

How about using rsync?

Code: Select all

# rsync -av -e "ssh -p 6336" myfile.text root@newserersvip:/directoryonnewserver/
Or preferably with connection alias:

Code: Select all

# cat ~/.ssh/config
Host newsrv
  User root
  HostName newserersvip
  Port 6336
#
# rsync -av myfile.text newsrv:/directoryonnewserver/

User avatar
TrevorH
Forum Moderator
Posts: 29171
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: SCP command not found

Post by TrevorH » 2020/04/30 22:33:02

Bash doesn't say what it says unless it thinks the whole thing is one word:

Code: Select all

[trevor@centos8 mate]$ scp -p6336
usage: scp [-346BCpqrTv] [-c cipher] [-F ssh_config] [-i identity_file]
            [-J destination] [-l limit] [-o ssh_option] [-P port]
            [-S program] source ... target
[trevor@centos8 mate]$ scp\ -p6336
-bash: scp -p6336: command not found
[trevor@centos8 mate]$ 
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

User avatar
jlehtone
Posts: 2940
Joined: 2007/12/11 08:17:33
Location: Finland

Re: SCP command not found

Post by jlehtone » 2020/05/01 09:23:05

scottro wrote:
2020/04/30 09:32:05
ssh-clients, though I suspect that's a default package with install.
On both CentOS 7 and 8:
* ssh-client is a mandatory package for group Core
* group Core is mandatory group for every Environment Group

It is thus quite a feat to not have scp installed.

c9dy
Posts: 4
Joined: 2020/04/29 18:04:17

Re: SCP command not found

Post by c9dy » 2020/05/01 11:41:26

rsynch doesn't work either

ssh clients is installed

c9dy
Posts: 4
Joined: 2020/04/29 18:04:17

Re: SCP command not found

Post by c9dy » 2020/05/01 11:55:51

On my other servers this works just fine between A & B and B & A (A & B are CentOS 6.x)

Code: Select all

root@server [~]# scp -P6336  php7.zip root@IPADDRESS:/home/
root@77.245.68.3's password: 
stdin: is not a tty
php7.zip                                                                                               100%  142KB 142.3KB/s   00:00    
root@server [~]# 
The new CentOS7 (say Server C) server just won't have it to or from A or B but ssh is fine

User avatar
TrevorH
Forum Moderator
Posts: 29171
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: SCP command not found

Post by TrevorH » 2020/05/01 12:51:06

Whatever it is that you're running, when bash says "scp -p6336" is not found, it means it's trying to run that as one command. It either means that's not a space or you're somehow managing to invoke "scp -p6336" instead of "scp" "-p6336". If it couldn't find scp it would say "-bash: scp: command not found"
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

Post Reply

Return to “CentOS 7 - General Support”