Solved

How to verify if SFTP is enabled in a UNIX box .

Posted on 2012-03-09
10
9,283 Views
Last Modified: 2012-06-22
Hi,

I am trying to establish a connection via SFTP from a UNIX to a ip and I get the below error . The ip is valid and the firewall is also opened up from the ip . Is there a way to identify if there is an issue in the source UNIX box .

java.net.SocketException: Connection timed out:could be due to invalid address
com.jcraft.jsch.JSchException: java.net.SocketException: Connection timed out:co
uld be due to invalid address
0
Comment
Question by:FranklinRaj22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +2
10 Comments
 
LVL 3

Expert Comment

by:StuWhitby
ID: 37703504
ps -ef | grep ftp should tell you if it's running.  I'd expect to see sftpd or ftpd or similar.

You should also be able to telnet to the port.  Also, since it's complaining about the address rather than the port (though it does show as a socket exception), check that the address itself is reachable via ping or traceroute.  

It's unlikely that the issue is in the source box.  Check basic networking though by trying external websites (or websites on the same domain as you're trying to ftp to).
0
 
LVL 48

Accepted Solution

by:
Tintin earned 250 total points
ID: 37703630
StuWhitby, sftp doesn't run as a daemon, it is a sub-system of ssh.

Try connecting on the command line rather than through your Java app, eg:

sftp user@ip
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 37704065
Can you login to the unix server? if yes then:

the server ip is ok, and if you use ssh then you should not have a problem using sftp since it runs on the same port of ssh.

If you are able to login to the unix server by some other means, then try this command from command prompt on the unix box

sftp 0

if you can not reach the unix box then it could be a network issue. It could be routing. check routing on your system and on the unix box.
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 37704329
Just checking whether sftp is 'enabled' is just a matter of typing 'sftp' on from a shell prompt. What kind of UNIX do you have btw? Are you able to connect to the ip address from your UNIX box using 'telnet' for example? Try 'telnet <ip address>' and 'ping <ip address>' to see if your destination is reachable.
0
 
LVL 5

Assisted Solution

by:hossamshaaban
hossamshaaban earned 250 total points
ID: 37704761
svcs -a|grep sshd
0
 
LVL 48

Expert Comment

by:Tintin
ID: 37705512
hossamshaaban, no mention of Solaris was made anywhere in this thread.

Additionally, having sshd running, doesn't mean the sftp subsystem is enabled.

Also, having sshd running on your local server doesn't have any bearing on whether you can connect to a remote server.
0
 
LVL 5

Expert Comment

by:hossamshaaban
ID: 37705744
sftp is inserted module in SSH, so when SSH is enabled SFTP should be enabled also by default.
0
 
LVL 48

Expert Comment

by:Tintin
ID: 37705913
SFTP is only enabled if it is defined in /etc/ssh/sshd_config, eg:

Subsystem sftp /usr/lib/openssh/sftp-server
0
 
LVL 5

Expert Comment

by:hossamshaaban
ID: 37706418
yes, that  mean and i think my reply show that and this line is exist by default.
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 37707546
@FranklinRaj22 - Any progress from your side worth mentioning?
0

Featured Post

Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Getting hacked is no longer a matter or "if you get hacked" — the 2016 cyber threat landscape is now titled "when you get hacked." When it happens — will you be proactive, or reactive?
Transferring data across the virtual world became simpler but protecting it is becoming a real security challenge.  How to approach cyber security  in today's business world!
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question