SFTP Issue - Connection closed


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers SFTP Issue - Connection closed
# 1  
Old 08-19-2011
SFTP Issue - Connection closed

Hi All,
I have followed the steps to set up the public and private keys for SFTP setup. Somehow the SFTP is not working and I get following errors:


==> sftp -v remote_user@remote_host_name_changed
OpenSSH_5.4p1, OpenSSL 0.9.8m 25 Feb 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Failed dlopen: /usr/krb5/lib/libkrb5.a(libkrb5.a.so): Could not load module /usr/krb5/lib/b5.a(libkrb5.a.so).
System error: No such file or directory

debug1: Error loading Kerberos, disabling Kerberos auth.
debug1: Connecting to ftwaxdevd001 [170.49.18.117] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/id_rsa type -1
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: identity file /home/user/.ssh/id_dsa type 2
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.2
debug1: match: OpenSSH_5.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.4
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'remote_host_name_changed' is known and matches the RSA host key.
debug1: Found key in /home/user/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /home/user/.ssh/id_rsa
debug1: Offering public key: /home/user/.ssh/id_dsa
debug1: Server accepts key: pkalg ssh-dss blen 433
debug1: read PEM private key done: type DSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending subsystem: sftp
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 2392, received 2304 bytes, in 2.8 seconds
Bytes per second: sent 854.2, received 822.7
debug1: Exit status 1
Connection closed


Initially I suspected that it might be following line:
debug1: Failed dlopen: /usr/krb5/lib/libkrb5.a(libkrb5.a.so): Could not load module /usr/krb5/lib/b5.a(libkrb5.a.so).

but SFTP works when we enter the password.

Any ideas???
# 2  
Old 08-19-2011
sounds like the remote public key is not setup properly.

what are the permissions for $HOME/.ssh and $HOME/.ssh/authorized_keys. make sure the public key is one line.
# 3  
Old 08-19-2011
1. on the remote box as the user you are connecting to:
Code:
# remote name = user remote home directory = /home/user
#
chmod 755 /home/user
chmod 700 /home/user/.ssh

# 4  
Old 08-19-2011
On the remote server, permissions on home dir is 755 and $HOME/.ssh dir is 700.

---------- Post updated at 02:25 PM ---------- Previous update was at 09:56 AM ----------


Any ideas????

Smilie
# 5  
Old 08-19-2011
So what is the issue here?

When you do sftp <remotehost> it is asking for a password instead of logging you in with the keys? Is that the issue?

I am looking at the debug you posted, does not look like keys are the issues, and it looks it is logging you in with the keys, so i am not seeing any issue here, but maybe I don't understand it, pardon me if that is the case.

Code:
debug1: Server accepts key: pkalg ssh-dss blen 433
debug1: read PEM private key done: type DSA
debug1: Authentication succeeded (publickey).

The above looks like server accepted the public key so no issue here.

Code:
debug1: Entering interactive session.
debug1: Sending subsystem: sftp

This looks like you got into SFTP as well and were able to transfer data and then you closed the connection. I am not seeing any issue.

Code:
Transferred: sent 2392, received 2304 bytes, in 2.8 seconds
Bytes per second: sent 854.2, received 822.7
debug1: Exit status 1
Connection closed

# 6  
Old 08-19-2011
It is not asking for any password.

Usually when I say SFTP USER@SERVER then I go into the SFTP prompt and from there I can get/put any file.

So SFTP prompt is not coming. Yes I also saw the bytes received and sent and then connection was closed.

I am trying to set up SFTP from SERVER_A to SERVER_B. Users on these servers are different.

So I have generated the pub/private keys for USER_A on SERVER_A. I then SFTP'ed the PUB file for USER_A on SERVER_B using password and copied this public file to authorized_keys file.

USER_B is the FTP Userid only.


========================
Please not that I have my userid on both the servers say USER_PERSONAL and I am able to set up SFTP without asking for password going from SERVER_A to SERVER_B.
========================
# 7  
Old 08-19-2011
So looks like USER_A's login profile must be screwed up. What OS are you on? And what shell is userA using?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Server closed the connection unexpectedly

Hi, I have a bash script which connects HP Vertica DB and executes few sql files in sequential manner. One sql file has commands related to one table(stage , base schema tables)and contains 7-8 commands such as creating temp table, inserting data into tables etc. For few tables, which have high... (7 Replies)
Discussion started by: Dharmatheja
7 Replies

2. UNIX for Dummies Questions & Answers

Exit Status 255, Connection closed in SFTP

I'm trying to connect from Server A to Server B to transfer files from A to B. I'm using NUID A1 in Server A and NUID A2 in Server B. I have done the following the steps to setup password-less login. 1. Add the public key of A1 in A to the Authorized keys of A2 in B. 2. Add the public key of... (4 Replies)
Discussion started by: sanchid312
4 Replies

3. UNIX for Advanced & Expert Users

How keep running a program n an another computer via a connection ssh when the connection is closed?

Hi everybody, I am running a program on a supercomputer via my personal computer through a ssh connection. My program take more than a day to run, so when I left work with my PC I stop the connection with the supercomputer and the program stop. I am wondering if someone know how I can manage... (2 Replies)
Discussion started by: TomTomGre
2 Replies

4. AIX

ssh connection closed by ip

Hi i am trying to do ssh without password between 2 aix servers. before i generate the keys, i am able to do the ssh & it is asking for password & i am able to login. ======================== # ssh 172.29.150.77 root@172.29.150.77's password: ======================== but when i generate rsa... (1 Reply)
Discussion started by: makarand.bhatka
1 Replies

5. HP-UX

Connection closed by foreign host

I am trying to connect to my HP server from remote machine. It gets connected but once credential are provided the connection is closed. adroit:/home/seo/hitendra 32 ] telnet myserv1 Trying... Connected to myserv1. Escape character is '^]'. Local flow control on Telnet TERMINAL-SPEED... (4 Replies)
Discussion started by: hiten.r.chauhan
4 Replies

6. UNIX for Advanced & Expert Users

Tomcat Connection closed

Hi how can do why a process closed a connection? # lsof -i tcp:8080 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME java 5851 tomcat 29u IPv6 73216185 TCP *:webcache (LISTEN) # telnet localhost 8080 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1).... (0 Replies)
Discussion started by: lain
0 Replies

7. HP-UX

ftp first connection closed

Hi, Have anyone seen this problem, there is one remote side where their ftp connection to our server will always fail with connection closed by remote host and the second connection will be working. is this an OS issue or network issue? Thanks Robert (4 Replies)
Discussion started by: robertngo
4 Replies

8. UNIX for Dummies Questions & Answers

ssh_exchange_identification: Connection closed by remote host Connection closed

Hi Everyone, Good day. Scenario: 2 unix servers -- A (SunOS) and B (AIX) I have an ftp script to sftp 30 files from A to B which happen almost instantaneously i.e 30 sftp's happen at the same time. Some of these sftp's fail with the following error: ssh_exchange_identification: Connection... (1 Reply)
Discussion started by: jeevan_fimare
1 Replies

9. UNIX for Advanced & Expert Users

SFTP Connection Closed

Hey when trying to connect to a server using a key I get sftp -o 'Port=22' -o'IdentityFile=/home/datatel/.ssh/id_dsa_xei' becker_xei@host Connecting to host... ANGEL SFTP ServerConnection closed by host Connection closed Any ideas? (1 Reply)
Discussion started by: ed.browne
1 Replies

10. UNIX for Dummies Questions & Answers

no shell connection closed error

Hi, I have created some users on my new enviroment on sun solaris in the aptempt to create a .profile which I did. I must have done something wrong because when I try to connect to one of this users it says:no shell, connection closed. The only thing I can think is that in my .profile I inserted... (2 Replies)
Discussion started by: giulianob
2 Replies
Login or Register to Ask a Question