SSH help !!!!

zener

Senior member
Aug 1, 2000
497
0
0
I try to copy files via scp between two systems using ssh and get this error :
scp:warning : child process (/usr/local/bin/ssh2) exited with code 0. Any help is mostly welcome.
 

drag

Elite Member
Jul 4, 2002
8,708
0
0
It may be that you are using a ssh1 client scp with a ssh2 scp server or visa versa.

SSH1 is a older implication of SSH, SSH2 is a more modern and secure version that uses a different authentification system. Code 0 usually means "it works" though, but if it works it shouldn't return anything.... I personally never encountered this problem before...

But this is the only thing that cropped up in a google search.
From here
SCP

While ssh 2 does provide an scp client, the scp server is a part of ssh 1 (implemented in ssh 2 via ssh 1 compatibility). Because of this, scp also is not designed to work with chrootgroups; it will allow an attacker to place files on the system outside of the cage. When combined with ssh 1 shell access to the system, scp could place you at severe risk of compromise.

The simple solution to both these problems is to install only ssh 2.

SCP login to a pure SSH 2 server:

[root@shiva /root]# /usr/local/bin/scp index.html
bswopes@localhost:index.html
bswopes@localhost's password:
scp: warning: child process (/usr/local/bin/ssh2) exited with code 0.
[root@shiva /root]#

Try specifying ssh2 or ssh1 protocol with scp.


scp -1 computer1:/path/to/filename computer2:/path/to/place/to/copy
or
scp -2 computer1:/path/to/filename computer2:/path/to/place/to/copy
 

zener

Senior member
Aug 1, 2000
497
0
0
The 2 systems are communicating thru a firewall. Should I need to do any tunneling for copying form one station to another? Right now I can rlogin to another system but cannot copy anything.
 

Barnaby W. Füi

Elite Member
Aug 14, 2001
12,343
0
0
Originally posted by: drag

SSH1 is a older implication of SSH, SSH2 is a more modern and secure version that uses a different authentification system. Code 0 usually means "it works" though, but if it works it shouldn't return anything.... I personally never encountered this problem before...

Programs always return something.

knoppix@ttyp1[tmp]$ cat >foo.c
int main(void) {}
knoppix@ttyp1[tmp]$ gcc -Wall foo.c
foo.c: In function `main':
foo.c:1: warning: control reaches end of non-void function
knoppix@ttyp1[tmp]$ ./a.out
knoppix@ttyp1[tmp]$ echo $?
0


(stuck on knoppix, hard drive failure ;))
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Originally posted by: zener
The 2 systems are communicating thru a firewall. Should I need to do any tunneling for copying form one station to another? Right now I can rlogin to another system but cannot copy anything.

Can you ssh to the system? What do you get when you use the -v flag?
 

zener

Senior member
Aug 1, 2000
497
0
0
Apparently I do not configfure right ssh. Please help me correct it. Below is the response after running ssh with the -v flag :
poncho% ssh2 -v -X -l badboy yyy.yyy.yyy.yyy
debug: Ssh2/ssh2.c:1650: License file found, PKI enabled = TRUE.
debug: SshConfig/sshconfig.c:2838: Metaconfig parsing stopped at line 3.
debug: SshConfig/sshconfig.c:3130: Read 0 params from config file.
debug: Ssh2/ssh2.c:1707: User config file not found, using defaults. (Looked for '/export/home/hvt/.ssh2/ssh2_c
onfig')
debug: Connecting to yyy.yyy.yyy.yyy, port 22... (SOCKS not used)
debug: Ssh2Transport/trcommon.c:3676: My version: SSH-1.99-3.2.9 SSH Secure Shell
debug: client supports 3 auth methods: 'publickey,keyboard-interactive,password'
debug: Ssh2Common/sshcommon.c:537: local ip = xxx.xxx.xxx.xxx, local port = 33847
debug: Ssh2Common/sshcommon.c:539: remote ip = yyy.yyy.yyy.yyy, remote port = 22
debug: SshConnection/sshconn.c:1945: Wrapping...
debug: SshReadLine/sshreadline.c:2427: Initializing ReadLine...
debug: Remote version: SSH-2.0-3.2.9 SSH Secure Shell
debug: Major: 3 Minor: 2 Revision: 9
debug: Ssh2Transport/trcommon.c:1367: lang s to c: `', lang c to s: `'
debug: Ssh2Transport/trcommon.c:1433: c_to_s: cipher aes128-cbc, mac hmac-sha1, compression none
debug: Ssh2Transport/trcommon.c:1436: s_to_c: cipher aes128-cbc, mac hmac-sha1, compression none
debug: Remote host key found from database.
debug: Ssh2Common/sshcommon.c:332: Received SSH_CROSS_STARTUP packet from connection protocol.
debug: Ssh2Common/sshcommon.c:382: Received SSH_CROSS_ALGORITHMS packet from connection protocol.
debug: server offers auth methods 'publickey,password'.
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1794: Starting pubkey auth...
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1751: Agent is not running.
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1549: Got 0 keys from the agent.
debug: SshConfig/sshconfig.c:2745: Unable to open /export/home/hvt/.ssh2/identification
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1529: Trying 0 key candidates.
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:983: All keys declined by server, disabling method.
debug: Ssh2AuthClient/sshauthc.c:319: Method 'publickey' disabled.
debug: server offers auth methods 'publickey,password'.
debug: Ssh2AuthPasswdClient/authc-passwd.c:105: Starting password auth...
badboy's password:
 

zener

Senior member
Aug 1, 2000
497
0
0
I did generate from pc2 the ssh keys and put the public key(.pub) in both pc1 and pc2 file named authorized_keys. However from the verbose text, it indicated that my setup is wrong. Help !!!!!
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Originally posted by: zener
I did generate from pc2 the ssh keys and put the public key(.pub) in both pc1 and pc2 file named authorized_keys. However from the verbose text, it indicated that my setup is wrong. Help !!!!!

Is this SSH.com's SSH client/server? If it is, I have no experience with it, but don't mind trying to help ;)

In OpenSSH, the public keys for ssh v2 go into ~/.ssh/authorized_keys2 I believe (does it really have the s?). It may be the same here. You also might want to specify the key file to use (-i flag in OpenSSH).

Of course, this doesn't look promising:
debug: server offers auth methods 'publickey,password'.
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1794: Starting pubkey auth...
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1751: Agent is not running.
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1549: Got 0 keys from the agent.
debug: SshConfig/sshconfig.c:2745: Unable to open /export/home/hvt/.ssh2/identification
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1529: Trying 0 key candidates.
debug: Ssh2AuthPubKeyClient/authc-pubkey.c:983: All keys declined by server, disabling method.
debug: Ssh2AuthClient/sshauthc.c:319: Method 'publickey' disabled.

You should check the documentation to make sure you have the server setup correctly (if the possible problem I mentioned earlier doesn't fix this).

debug: server offers auth methods 'publickey,password'.
debug: Ssh2AuthPasswdClient/authc-passwd.c:105: Starting password auth...
badboy's password:

It is offering the password prompt. Do you login if you enter the password?
 

zener

Senior member
Aug 1, 2000
497
0
0
OK it is working now. I need to configure both ssh_conf and sshd2_conf files. Thanks again for all the help !!!!