Operating System - HP-UX
1819801 Members
3087 Online
109607 Solutions
New Discussion юеВ

Can't get system to "find" scp command

 
Jeff Daigle
Advisor

Can't get system to "find" scp command

Hello, I am trying to run scp (secure copy) command. I keep getting "ksh: scp: not found" error. I get this even when I run the command from the directory that scp (and ssh) are in. I also get it when my command includes the full path to the scp command. Any help would be greatly appreciated. Thanks, Jeff

Here is what I ran:

>userID(server1: /fisc/gnu/bin): /fisc/gnu/bin/scp -p /home/userID/test.txt userID@server2:/home/userID/test.txt

And this is what was returned:

>ksh: scp: not found
lost connection



Any help on why it is not found would be greatly appreciated. Thanks, Jeff
26 REPLIES 26
Jeff Machols
Esteemed Contributor

Re: Can't get system to "find" scp command

Jeff,

If that "lost connection" message is showing, thats an error from scp so you are running it, there is some other error. Is that part of the error or something else you included?
Roger Baptiste
Honored Contributor

Re: Can't get system to "find" scp command

hi,

To get more info on what is exactly occuring use the
-v switch for the verbose option.
#scp -v

***

Next, to find out what binary it is using do
#what scp

I think the problem is at the server2 end. The verbose option will catch it.

HTh
raj
Take it easy.
Jeff Daigle
Advisor

Re: Can't get system to "find" scp command

 
Uday_S_Ankolekar
Honored Contributor

Re: Can't get system to "find" scp command

Hi,

If you are using secure shell (ssh ) then you can use scp.

Have a look at this link

http://www.openssh.com/
-USA..

Good Luck..
Roger Baptiste
Honored Contributor

Re: Can't get system to "find" scp command

hi,

Here is a sample example:
***
#scp2 -v /tmp/taj orv:/home/rmannar/taj
warning: Development-time debugging not compiled in.
warning: To enable, configure with --enable-debug and recompile.
Development-time debugging not compiled in.
To enable, configure with --enable-debug and recompile.
debug: hostname is 'orv'.
debug: Unable to open /home/rman/.ssh2/ssh2_config
Development-time debugging not compiled in.
To enable, configure with --enable-debug and recompile.
debug: connecting to orv...
debug: entering event loop
debug: ssh_client_wrap: creating transport protocol
debug: ssh_client_wrap: creating userauth protocol
debug: ssh_blob_read: file /home/rman/.ssh2/hostkeys/key_22_orv.pub does not exist.
Accepting host orv key without checking.
debug: Host key saved to /home/rman/.ssh2/hostkeys/key_22_orv.pub
debug: host key for orv, accepted by rman Mon Dec 10 15:20:00 2001
debug: Host key found from the database.
rman@orv's password:
debug: Ssh2/ssh2.c:306: client_authenticated
debug: DISPLAY not set; X11 forwarding disabled.
Transfering /tmp/taj -> orv:/home/rman/taj (1k)
|.........................................................................................................................|
168 bytes transferred in 0.06 seconds [2.67 kb/sec].
debug: ssh_pipe_stream_destroy
pega@/usr/local/bin>debug: session_close
debug: destroying client struct...
debug: uninitializing event loop
#
*****

the ssh2 server must be running on the remote system!

HTH
raj
Take it easy.
Jeff Machols
Esteemed Contributor

Re: Can't get system to "find" scp command

Jeff,

are you sure the command you are running is the actual scp command and a script using ssh and calling scp in it? The debug looks a little more like the ssh than the scp command (but I just may be on an older version)
Jeff Daigle
Advisor

Re: Can't get system to "find" scp command

Thanks Jeff. Yes, I am running the scp command, which is set up in /fisc/gnu/bin/

ssh is also in the same directory.

I ran it with verbose as displayed above. RajMan included the above debug example.

I don't know why I keep getting ksh: scp: not found. I am running the commmand with the full path to that scp command.

Thanks again, Jeff
Roger Baptiste
Honored Contributor

Re: Can't get system to "find" scp command

hi,

what's the output of
#what scp ??

Is the directory of scp binary in your PATH ??

-raj

Take it easy.
Jeff Machols
Esteemed Contributor

Re: Can't get system to "find" scp command

Try putting /fisc/gnu/bin in your $PATH env.
John Payne_2
Honored Contributor

Re: Can't get system to "find" scp command

If you already have the directory for the scp executable in your PATH, have you verified that the directory that it is contained in is executable by you? ie. You are in sys group as yourself, and permissions on directory are rwxr--r--? or something to that effect?

John
Spoon!!!!
Craig Rants
Honored Contributor

Re: Can't get system to "find" scp command

Jeff,
This error is telling you that your remote host cannot find scp, not the host that you are one. I don't know if this was pointed out in previous reply's. 100 Bucks says if you link ../bin/scp to /usr/sbin/scp then your copy will work. Of course that is not the recommended course of action, just a quick test. You will want to make sure that scp is in the path of the remote use.

GL,
C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Jeff Daigle
Advisor

Re: Can't get system to "find" scp command

RajMan, the output of

#what scp was...

$ what scp
scp:

Here is my PATH
(swift_fmtc: /home/myuserID): echo $PATH
/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/myuserID/bin:/usr/bin/X11:/sbin:.:/usr/loc
al/bin:/usr/local/etc:/swift1/softw/BSS/bin/AIX:/swft/softw/common/bin/AIX:/usr/sbin


Do I need to the directory of scp binary in my PATH?

Thanks much! Jeff
Uday_S_Ankolekar
Honored Contributor

Re: Can't get system to "find" scp command

Hi,

Copy scp binary files in your $PATH.

-USA..
Good Luck..
Roger Baptiste
Honored Contributor

Re: Can't get system to "find" scp command

oops, it has to be
#which scp

(and not what).

The point is the location of your scp binary should be in the PATH variable:
so do
echo $PATH and check whether
/fisc/gnu/bin is present,
if not add it:
**
PATH=$PATH:/fisc/gnu/bin
export PATH
**

and then retry the scp command.

HTH
raj
Take it easy.
Jeff Daigle
Advisor

Re: Can't get system to "find" scp command

Thanks everybody. I just added the directory to my PATH. Now it is...

>echo $PATH
/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/myuserID/bin:/usr/bin/X11:/sbin:.:/usr/loc
al/bin:/usr/local/etc:/fisc/gnu/bin:/swift1/softw/BSS/bin/AIX:/swift1/softw/common/bin/AIX:/usr/sbin

So, now it includes /fisc/gnu/bin and when I run it I get...

>ksh: scp: not found
lost connection


Somewhere, it is not finding the scp command- right? Since it is in my PATH (on both servers), I would think it would find it.

Thank you very much. Jeff
Roger Baptiste
Honored Contributor

Re: Can't get system to "find" scp command

hi,

is ssh working fine??
(leaving aside scp for the moment). Did it work fine before this error?

I am beginning to suspect this could be a ssh installation error.

Another suspect is the ssh version. There are two versions, version1 and version2 and they are incompatible. So, do you have the same version (binaries)
on both the systems?

Can you try ssh and see whether it works?
ssh -v userid@server2

HTH
raj
Take it easy.
Jeff Daigle
Advisor

Re: Can't get system to "find" scp command

Thanks for the help everyone!

John, this is the permissions info on those directories:

drwxr-sr-x 5 root system 512 Nov 28 17:46 fisc

drwxr-sr-x 5 root system 512 Nov 28 17:46 gnu

drwxr-sr-x 2 root system 512 Dec 7 09:59 bin

And here is the info on the scp itself:
-rwxr-xr-x 1 root sys 61362 Nov 28 17:46 scp


I'm not sure what the "s" means in the 7th permission spot of the fisc, gnu and bin directories. Could this not allow me to execute it? If so, would that still give me the "ksh: scp: not found" error?

Thanks so much.
Jeff Daigle
Advisor

Re: Can't get system to "find" scp command

Hi RajMan,

I am able to ssh without any problem. I have ssh'ed from server1 to server2 and visa versa.

Thanks.
Roger Baptiste
Honored Contributor

Re: Can't get system to "find" scp command

hi,

<>

The file size seems much lesser than what i have on my system (which uses scp version 2).
The size of the file is:
-r-xr-xr-x 1 root sys 606976 Oct 4 1999 scp2

Other useful info:
#file scp2
scp2: PA-RISC2.0 shared executable dynamically linked -not stripped
#>what /usr/local/bin/scp2
/usr/local/bin/scp2:
HP92453-02A.11.00 HP-UX SYMBOLIC DEBUGGER (END.O ILP32) $Revision: 75.02 $
**

Is the scp file you have
a binary or is it a wrapper which is calling the actual
scp binary??? I am beginning to suspect that is the case.

Run "file" and "what" commands
on the *full* path of the scp binary and check the output.

HTH
raj


Take it easy.
Craig Rants
Honored Contributor

Re: Can't get system to "find" scp command

Jeff,
Have you tried my idea of linking the scp to /usr/sbin on your remote host?

I have seen this many times and most of the time that is the root of my problem.

C
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
John Payne_2
Honored Contributor

Re: Can't get system to "find" scp command

The directory permissions look ok. The 's' in rwxr-sr-x is for the set-group-ID.

I am running ssh-3.0.1 from www.ssh.com. My version of scp2 has: 1214952 Nov 28 15:07 scp2 size.

What version of ssh are you running on the server? If different versions, have you looked for a bug report yet? Or a CHANGES file?

John
Spoon!!!!
Craig Rants
Honored Contributor

Re: Can't get system to "find" scp command

I have done some more research and I am sticking with my first suggestion. Try this command:

ssh -l username hostname "echo $PATH"

you will only get back

/bin /usr/bin /usr/sbin /sbin

That is why you can't find scp.

You will need to recompile with the --with-default-path=/usr/local/bin

or what ever bin dir you are using.

Good Luck,
Craig
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Mark Fenton
Esteemed Contributor

Re: Can't get system to "find" scp command

Jeff,

Have to agree with Craig -- it looks like scp isn't being found on the remote side of your connection. Missed this check in your postings -- did you ascertain that it does, indeed exist on the server? The output from your -v run certainly indicates that everything is working properly up to the point that the scp command is actually passed on to the server:

server1: Enabling compression at level 6.
server1: Sending command: scp -v -f /home/userID/test.jef
server1: Entering interactive session.
ksh: scp: not found

and then you get the "not found" message.

As a quick test, I renamed scp on my server and attempted some such test -- also received the "lost connection" message.

best regards.
Mark
Shannon Petry
Honored Contributor

Re: Can't get system to "find" scp command

The default error message from OpenSSH tools is "lost connection".. If you ssh to foobar.nowhere.xyz, you will see the same error!
I second the ideas of the path because scp does not process the home dot-files like ssh does. for this reason, you need to link the binaries to common directories, or recompile and add directories in the configure script (the afore mentioned is much easier than the latter!).

The test as mentioned before of echoing the path will tell if it is the problem.

Best regards,
Shannon
Microsoft. When do you want a virus today?