LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 09-20-2011, 04:13 AM   #1
cuongvuxuan
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Rep: Reputation: 0
SSH with "Connection closed by…" Error


I've got two servers using OS “Red Hat Enterprise Linux AS release 4 Update 4"
I setup follow for ssh:
- Source machine: 192.168.1.99

oraprod@test ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oraprod/.ssh/id_rsa):
Created directory '/home/oraprod/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oraprod/.ssh/id_rsa.
Your public key has been saved in /home/oraprod/.ssh/id_rsa.pub.
The key fingerprint is:
9a:f6:48:55:f9:0d:b4:93:fe:c1:10:da:ca:0b:41:77 oraprod@test.hapaco.vn
[oraprod@test ~]$ cd .ssh
[oraprod@test .ssh]$ cp id_rsa.pub authorized_keys


- Copy authorized_keys (if .ssh folder doesn’t exist on destination machine, copy all folder) from source machine to destination machine (192.168.1.100 )

- set permission 777 for .shh folder and authorized_keys file on destination machine

- From 192.168.1.99 login to 192.168.1.100

[oraprod@test ~]$ slogin 192.168.5.100
Connection closed by 192.168.5.100


But i always received: “Connection closed by 192.168.5.100”

I changed 192.168.5.100 by another server 192.168.5.98 and setup it the same 192.168.5.100. But I login from 192.168.5.99 to 192.168.5.98 successfully

Could you help me. What’s wrong with 192.168.5.100 ?
Thanks you
 
Old 09-20-2011, 05:05 AM   #2
jsaravana87
Member
 
Registered: Aug 2011
Location: Chennai,India
Distribution: Redhat,Centos,Ubuntu,Dedian
Posts: 558
Blog Entries: 5

Rep: Reputation: Disabled
i could recommend u to use putty key generator for generating public and private keys
vi /etc/ssh/sshd_config enabled below line

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys

%h define u can login diff users with pub key r else u can use only for root

just

generate a key using putty generator copy the public key to /.ssh/authorized_keys terminal in ur server


chmod -R 777 /.ssh/authorized_keys

u have to paste the keys properly in authorised_keys terminal r else u will server refused our key error

copy the private key to ur putty and just login u can login


like these u could get while generating pub key in putty generator
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAg2CZvrXsoEEaFKcrQrCllxtnxAMqcJWMMgya0udXGpHJwqjDXMq1J+5LXB2zw/ZbplHx5gwyPDzszwTsAWGF7j4oykkmX/I1ayyjoJ+prwp4XzbpJ152DJ2QZhyEiMFUxFxjKNyTgdhDd3igkM1/NpZwhFmvcQXL95pWX8fjUj8= ssh-rsa 15245


vi .ssh/authorizedkeys
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAg2CZvrXsoEEaFKcrQrCllxtnxAMqcJWMMgya0udXGpHJwqjDXMq1J+5LXB2zw/ZbplHx5gwyPDzszwTsAWGF7j4oykkmX/I1ayyjoJ+prwp4XzbpJ152DJ2QZhyEiMFUxFxjKNyTgdhDd3igkM1/NpZwhFmvcQXL95pWX8fjUj8=

remove ssh-rsa 15245 while pasting in ur authorized key terminal

try it if u face error come once again

Last edited by jsaravana87; 09-20-2011 at 05:11 AM.
 
Old 09-20-2011, 05:08 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by cuongvuxuan View Post
- set permission 777 for .shh folder and authorized_keys file on destination machine
/home/oraprod/.ssh should owned by oraprod and group oraprod and have at most octal 0750 and not 0777, /home/oraprod/.ssh/authorized_keys is suggested to have at most 0600.


Quote:
Originally Posted by cuongvuxuan View Post
What’s wrong with 192.168.5.100 ?
Can't tell. On the client issue slogin as 'slogin -vv' and save output. On the server look at where sshd logs to and see if there's any ssh lines post output of both.
 
1 members found this post helpful.
Old 09-20-2011, 11:19 PM   #4
cuongvuxuan
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by arun5002 View Post
i could recommend u to use putty key generator for generating public and private keys
vi /etc/ssh/sshd_config enabled below line

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/.ssh/authorized_keys

%h define u can login diff users with pub key r else u can use only for root

just

generate a key using putty generator copy the public key to /.ssh/authorized_keys terminal in ur server


chmod -R 777 /.ssh/authorized_keys

u have to paste the keys properly in authorised_keys terminal r else u will server refused our key error

copy the private key to ur putty and just login u can login


like these u could get while generating pub key in putty generator
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAg2CZvrXsoEEaFKcrQrCllxtnxAMqcJWMMgya0udXGpHJwqjDXMq1J+5LXB2zw/ZbplHx5gwyPDzszwTsAWGF7j4oykkmX/I1ayyjoJ+prwp4XzbpJ152DJ2QZhyEiMFUxFxjKNyTgdhDd3igkM1/NpZwhFmvcQXL95pWX8fjUj8= ssh-rsa 15245


vi .ssh/authorizedkeys
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAg2CZvrXsoEEaFKcrQrCllxtnxAMqcJWMMgya0udXGpHJwqjDXMq1J+5LXB2zw/ZbplHx5gwyPDzszwTsAWGF7j4oykkmX/I1ayyjoJ+prwp4XzbpJ152DJ2QZhyEiMFUxFxjKNyTgdhDd3igkM1/NpZwhFmvcQXL95pWX8fjUj8=

remove ssh-rsa 15245 while pasting in ur authorized key terminal

try it if u face error come once again

Dear arun5002

I did following your instructions

FIRST TIME:
- I edited /etc/ssh/sshd_config and here’s Its contents now

#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile %h/ .ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

"/etc/ssh/sshd_config" 111L, 3026C 43,1
35%


- And then

[oraprod@test ~]$ su - root
Password:
[root@test ~]# vi /etc/ssh/sshd_config
[root@test ~]# su - oraprod
[oraprod@test ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oraprod/.ssh/id_rsa):
/home/oraprod/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oraprod/.ssh/id_rsa.
Your public key has been saved in /home/oraprod/.ssh/id_rsa.pub.
The key fingerprint is:
d0:86:28:3a:57:91:4f:ed:3f:43:13:61:61:15:20:91 oraprod@test.hapaco.vn
[oraprod@test ~]$ cd .ssh
[oraprod@test .ssh]$ cp id_rsa.pub authorized_keys


- Copy authorized_keys from 192.168.5.99 to 192.168.5.100. Here is content of authorized_keys file

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAtHNi8HwS1LSmDZ4ttVNxDrM8cCssSu8G4y8QvP6lz4O8P3iV2hJQlt1xwo8Au46KoysMNQYF zxGcxL1KVtWZnQcwU9l4CS8e2f5Y4cwUvaMYMvUFt0N1VUU+49chLe2Xb8Ohq/0aUQpNIbyNPG1h5m962eeAGcgXOJjk6L7dkHU= oraprod@test.hapaco.vn

- I login and here’s the result:

[oraprod@test .ssh]$ slogin -vv 192.168.5.100
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.5.100 [192.168.5.100] port 22.
debug1: Connection established.
debug1: identity file /home/oraprod/.ssh/identity type -1
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug2: key_type_from_name: unknown key type '-----END'
debug1: identity file /home/oraprod/.ssh/id_rsa type 1
debug1: identity file /home/oraprod/.ssh/id_dsa type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.9p1
debug1: match: OpenSSH_3.9p1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.9p1
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_init: found hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_init: found hmac-md5
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 132/256
debug2: bits set: 512/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '192.168.5.100' is known and matches the RSA host key.
debug1: Found key in /home/oraprod/.ssh/known_hosts:2
debug2: bits set: 492/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/oraprod/.ssh/identity ((nil))
debug2: key: /home/oraprod/.ssh/id_rsa (0x9716668)
debug2: key: /home/oraprod/.ssh/id_dsa ((nil))
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic

debug1: An invalid name was supplied
Cannot determine realm for numeric host address



debug1: An invalid name was supplied
Cannot determine realm for numeric host address

debug2: we did not send a packet, disable method
debug1: Next authentication method: publickey
debug1: Trying private key: /home/oraprod/.ssh/identity
debug1: Offering public key: /home/oraprod/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
Connection closed by 192.168.5.100


SECOND TIME
- I removed oraprod@test.hapaco.vn from authorized_keys and then copied it to 192.168.5.100
Here’s content of authorized_keys file

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAtHNi8HwS1LSmDZ4ttVNxDrM8cCssSu8G4y8QvP6lz4O8P3iV2hJQlt1xwo8Au46KoysMNQYF zxGcxL1KVtWZnQcwU9l4CS8e2f5Y4cwUvaMYMvUFt0N1VUU+49chLe2Xb8Ohq/0aUQpNIbyNPG1h5m962eeAGcgXOJjk6L7dkHU=

- Login again:

[oraprod@test ~]$ slogin -vv 192.168.5.100
OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.5.100 [192.168.5.100] port 22.
debug1: Connection established.
debug1: identity file /home/oraprod/.ssh/identity type -1
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug2: key_type_from_name: unknown key type '-----END'
debug1: identity file /home/oraprod/.ssh/id_rsa type 1
debug1: identity file /home/oraprod/.ssh/id_dsa type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.9p1
debug1: match: OpenSSH_3.9p1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.9p1
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit: none,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_init: found hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_init: found hmac-md5
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 140/256
debug2: bits set: 513/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '192.168.5.100' is known and matches the RSA host key.
debug1: Found key in /home/oraprod/.ssh/known_hosts:2
debug2: bits set: 505/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /home/oraprod/.ssh/identity ((nil))
debug2: key: /home/oraprod/.ssh/id_rsa (0x99a9668)
debug2: key: /home/oraprod/.ssh/id_dsa ((nil))
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: An invalid name was supplied
Cannot determine realm for numeric host address

debug1: An invalid name was supplied
Cannot determine realm for numeric host address

debug2: we did not send a packet, disable method
debug1: Next authentication method: publickey
debug1: Trying private key: /home/oraprod/.ssh/identity
debug1: Offering public key: /home/oraprod/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply




Connection closed by 192.168.5.100




At the and I haven't solve this problem.
Thanks you
 
Old 09-21-2011, 12:31 AM   #5
jsaravana87
Member
 
Registered: Aug 2011
Location: Chennai,India
Distribution: Redhat,Centos,Ubuntu,Dedian
Posts: 558
Blog Entries: 5

Rep: Reputation: Disabled
[oraprod@test ~]$ su - root
Password:
[root@test ~]# vi /etc/ssh/sshd_config
[root@test ~]# su - oraprod
[oraprod@test ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oraprod/.ssh/id_rsa):
/home/oraprod/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oraprod/.ssh/id_rsa.
Your public key has been saved in /home/oraprod/.ssh/id_rsa.pub.
The key fingerprint is:
d0:86:28:3a:57:91:4f:ed:3f:43:13:61:61:15:20:91 oraprod@test.hapaco.vn
[oraprod@test ~]$ cd .ssh
[oraprod@test .ssh]$ cp id_rsa.pub authorized_keys

- Copy authorized_keys from 192.168.5.99 to 192.168.5.100. Here is content of authorized_keys file

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAtHNi8HwS1LSmDZ4ttVNxDrM8cCssSu8G4y8QvP6lz4O8P3iV2hJQlt1xwo8Au46KoysMNQYF zxGcxL1KVtWZnQcwU9l4CS8e2f5Y4cwUvaMYMvUFt0N1VUU+49chLe2Xb8Ohq/0aUQpNIbyNPG1h5m962eeAGcgXOJjk6L7dkHU=





u does int need to generate key using

[oraprod@test ~]$ ssh-keygen -t rsa these command
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oraprod/.ssh/id_rsa)



just generate a pub key in putty password generator click public key it will generate a pub key just copy it and paste it to ur authorized_keys

chmod -R 777 /.ssh/authorized_keys

put ur private key generate by putty to ur putty terminal and logon u can login .if ur using putty password generator for generating pub &private key so that there is not no need to generate password via ssh-keygen -t rsa commmand in ur terminal

like these u could get while generating pub key in putty generator
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAg2CZvrXsoEEaFKcrQrCllxtnxAMqcJWMMgya0udXGpHJwqjDXMq1J+5LXB2zw/ZbplHx5gwyPDzszwTsAWGF7j4oykkmX/I1ayyjoJ+prwp4XzbpJ152DJ2QZhyEiMFUxFxjKNyTgdhDd3igkM1/NpZwhFmvcQXL95pWX8fjUj8= ssh-rsa 15245



remove these line ssh-rsa 15245 while pasting to ur authorizedkeys terminal
vi .ssh/authorizedkeys
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAg2CZvrXsoEEaFKcrQrCllxtnxAMqcJWMMgya0udXGpHJwqjDXMq1J+5LXB2zw/ZbplHx5gwyPDzszwTsAWGF7j4oykkmX/I1ayyjoJ+prwp4XzbpJ152DJ2QZhyEiMFUxFxjKNyTgdhDd3igkM1/NpZwhFmvcQXL95pWX8fjUj8=



try it

Last edited by jsaravana87; 09-21-2011 at 12:33 AM.
 
Old 09-21-2011, 03:20 AM   #6
cuongvuxuan
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by arun5002 View Post
[oraprod@test ~]$ su - root
Password:
[root@test ~]# vi /etc/ssh/sshd_config
[root@test ~]# su - oraprod
[oraprod@test ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oraprod/.ssh/id_rsa):
/home/oraprod/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oraprod/.ssh/id_rsa.
Your public key has been saved in /home/oraprod/.ssh/id_rsa.pub.
The key fingerprint is:
d0:86:28:3a:57:91:4f:ed:3f:43:13:61:61:15:20:91 oraprod@test.hapaco.vn
[oraprod@test ~]$ cd .ssh
[oraprod@test .ssh]$ cp id_rsa.pub authorized_keys

- Copy authorized_keys from 192.168.5.99 to 192.168.5.100. Here is content of authorized_keys file

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEAtHNi8HwS1LSmDZ4ttVNxDrM8cCssSu8G4y8QvP6lz4O8P3iV2hJQlt1xwo8Au46KoysMNQYF zxGcxL1KVtWZnQcwU9l4CS8e2f5Y4cwUvaMYMvUFt0N1VUU+49chLe2Xb8Ohq/0aUQpNIbyNPG1h5m962eeAGcgXOJjk6L7dkHU=





u does int need to generate key using

[oraprod@test ~]$ ssh-keygen -t rsa these command
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oraprod/.ssh/id_rsa)



just generate a pub key in putty password generator click public key it will generate a pub key just copy it and paste it to ur authorized_keys

chmod -R 777 /.ssh/authorized_keys

put ur private key generate by putty to ur putty terminal and logon u can login .if ur using putty password generator for generating pub &private key so that there is not no need to generate password via ssh-keygen -t rsa commmand in ur terminal

like these u could get while generating pub key in putty generator
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAg2CZvrXsoEEaFKcrQrCllxtnxAMqcJWMMgya0udXGpHJwqjDXMq1J+5LXB2zw/ZbplHx5gwyPDzszwTsAWGF7j4oykkmX/I1ayyjoJ+prwp4XzbpJ152DJ2QZhyEiMFUxFxjKNyTgdhDd3igkM1/NpZwhFmvcQXL95pWX8fjUj8= ssh-rsa 15245



remove these line ssh-rsa 15245 while pasting to ur authorizedkeys terminal
vi .ssh/authorizedkeys
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAg2CZvrXsoEEaFKcrQrCllxtnxAMqcJWMMgya0udXGpHJwqjDXMq1J+5LXB2zw/ZbplHx5gwyPDzszwTsAWGF7j4oykkmX/I1ayyjoJ+prwp4XzbpJ152DJ2QZhyEiMFUxFxjKNyTgdhDd3igkM1/NpZwhFmvcQXL95pWX8fjUj8=



try it
Dear arun5002

I ‘ve tried again follow your instructions. The content of authorized_keys is:

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEArpRjNZ0Q4ePMDbk9hWan2J0qpgilWGz7ETSPOU9C8PaIg5JNhCPZ+3oHdoO7mi0WNhNc6OCh wBNu/k+dEKsc8NXJbRFQzUCojvywXfWFHoyEXTcEyo6kUZhUdipXRwLKo70aHyB22Ah8Oyk7xvaQ9JjYTFCKYPYBEoqQ96BrHTc= oraprod@test.hapaco.vn

last line is “oraprod@test.hapaco.vn” (not “ssh-rsa 15245” as you thought) and i also removed this line before coping to 192.168.5.100

but when i login, the result is still the same
Further: Please don’t abbreviate, it’s very difficult for me to know what you say

Thank a lot
 
Old 09-21-2011, 05:16 AM   #7
Reuti
Senior Member
 
Registered: Dec 2004
Location: Marburg, Germany
Distribution: openSUSE 15.2
Posts: 1,339

Rep: Reputation: 260Reputation: 260Reputation: 260
Going back to the beginning and no exisiting .ssh directory anywhere. On the source machine 192.168.1.99 :
Code:
$ ssh-keygen -t rsa
$ ssh-copy-id 192.168.1.100
You have to supply one time the password and all is set up for you with the correct permissions.
 
Old 09-21-2011, 10:00 PM   #8
cuongvuxuan
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Reuti View Post
Going back to the beginning and no exisiting .ssh directory anywhere. On the source machine 192.168.1.99 :
Code:
$ ssh-keygen -t rsa
$ ssh-copy-id 192.168.1.100
You have to supply one time the password and all is set up for you with the correct permissions.

I removed .ssh folder and begin at first

Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
Kernel 2.6.9-42.ELsmp on an i686
login: oraprod
Password:
Last login: Thu Sep 22 09:50:26 from 192.168.1.81
You have new mail.
[oraprod@test ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oraprod/.ssh/id_rsa):
Created directory '/home/oraprod/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oraprod/.ssh/id_rsa.
Your public key has been saved in /home/oraprod/.ssh/id_rsa.pub.
The key fingerprint is:
f0:12:c1:e9:b8:a5:9f:fd:7f:e3:40:54:c2:21:b0:24 oraprod@test.hapaco.vn
[oraprod@test ~]$ ssh-copy-id 192.168.5.100
-bash: ssh-copy-id: command not found
[oraprod@test ~]$


I also used to try:
ssh-copy-id oraprod@192.168.5.100
-bash: ssh-copy-id: command not found

i also saw about this command (http://linux.die.net/man/1/ssh-copy-id) but i don't know why's that
Thanks and best regards
 
Old 09-21-2011, 10:45 PM   #9
ahkung79
LQ Newbie
 
Registered: Sep 2011
Posts: 2

Rep: Reputation: Disabled
Quote:
Originally Posted by cuongvuxuan View Post
I removed .ssh folder and begin at first

Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
Kernel 2.6.9-42.ELsmp on an i686
login: oraprod
Password:
Last login: Thu Sep 22 09:50:26 from 192.168.1.81
You have new mail.
[oraprod@test ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/oraprod/.ssh/id_rsa):
Created directory '/home/oraprod/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oraprod/.ssh/id_rsa.
Your public key has been saved in /home/oraprod/.ssh/id_rsa.pub.
The key fingerprint is:
f0:12:c1:e9:b8:a5:9f:fd:7f:e3:40:54:c2:21:b0:24 oraprod@test.hapaco.vn
[oraprod@test ~]$ ssh-copy-id 192.168.5.100
-bash: ssh-copy-id: command not found
[oraprod@test ~]$


I also used to try:
ssh-copy-id oraprod@192.168.5.100
-bash: ssh-copy-id: command not found

i also saw about this command (http://linux.die.net/man/1/ssh-copy-id) but i don't know why's that
Thanks and best regards


The ssh-copy-id might not exist in your rhel installation but doesn't matter, its function is already explained in the manpage that you pointed.

But have you tried other method like using cp, rcp to copy the public key strings generated to the remote machine /.ssh/authorized_keys files and try to ssh with verbose mode again?
 
Old 09-21-2011, 11:18 PM   #10
cuongvuxuan
LQ Newbie
 
Registered: Oct 2009
Posts: 7

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ahkung79 View Post
The ssh-copy-id might not exist in your rhel installation but doesn't matter, its function is already explained in the manpage that you pointed.

But have you tried other method like using cp, rcp to copy the public key strings generated to the remote machine /.ssh/authorized_keys files and try to ssh with verbose mode again?
command "rcp" means "Copy from/to remote server with SSH" (http://varrunr.wordpress.com/2009/05...rver-with-ssh/), now i have got problem with SSH so it can't do.
I copied to the remote machine by FTP and done many times but not successfull.
I think, the problem isn't using of coping method

Last edited by cuongvuxuan; 09-21-2011 at 11:22 PM.
 
Old 09-22-2011, 12:49 AM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
rcp has nothing to do with ssh (except ssh replaces it). Try this for a quick guide http://www.informit.com/articles/pri...p=169465&rll=1
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH issue ""Server unexpectedly closed network connection" Errsta_Fonzarelli Linux - Software 12 05-24-2010 02:35 PM
ssh problem "server unexpectedly closed network connection" sunilvadranapu SUSE / openSUSE 7 02-10-2010 02:43 AM
Different SSH "Server unexpectedly closed network connection" (using Putty) mjwraw Linux - Networking 4 07-22-2009 07:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:29 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration