LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices



Reply
 
Search this Thread
Old 08-15-2003, 10:17 PM   #1
Ikik
LQ Newbie
 
Registered: Aug 2003
Posts: 29

Rep: Reputation: 15
Question FTP and SSH


Hullo senior in linux, newbie needs help here : )

i got two linux box connected and i can ping each other but i can't ftp or ssh into one another, it always return the error message "connection refused".

Is there any particular things that i should set before i can use ftp or ssh ?

and is it also possible to ssh or telnet into window box?


TIA

-ik
 
Old 08-15-2003, 11:04 PM   #2
quest4knowledge
Member
 
Registered: Aug 2003
Distribution: gentoo
Posts: 62

Rep: Reputation: 15
connection refused probably means that you dont have any ssh or ftp daemons running. Or possibly firewall issues.

Check the output from this to find out what servers you have running:
ps ax | grep sshd
ps ax | grep ftpd
ps ax | grep inetd

Check the output from this to find firewall rules:
(for iptables)
iptables -L
(or ipchains)
ipchains -L
 
Old 08-15-2003, 11:20 PM   #3
joseph
Member
 
Registered: Jul 2003
Location: Batam
Distribution: Ubuntu 10 And Linux Mint
Posts: 414

Rep: Reputation: 30
yea, you can always telnet to windows box but first you need to activate your telnet server in windows boxes.
did you behind any firewall?
 
Old 08-15-2003, 11:55 PM   #4
Ikik
LQ Newbie
 
Registered: Aug 2003
Posts: 29

Original Poster
Rep: Reputation: 15
well kinda blur about firewall, dunno how to set it up but these are the output that i got :

Code:
[root@linuxserver admin]# ps ax | grep sshd
 2650 ?        S      0:00 /usr/sbin/sshd
 3809 pts/1    S      0:00 grep sshd

[root@linuxserver admin]# ps ax | grep ftpd
 3245 ?        S      0:00 proftpd (accepting connections)
 3815 pts/1    S      0:00 grep ftpd

[root@linuxserver admin]# ps ax | grep inetd
 2682 ?        S      0:00 xinetd -stayalive -reuse -pidfile /var/run/xinetd.pid
 3817 pts/1    S      0:00 grep inetd
and as for iptables -L command it returns so many stuff that i don understand.

ipchains cannot run at all, last time when i install it, it removes my iptables and the other way round.

from the message above, can anyone tell me if my daemons are running or not?

thanks

-ik
 
Old 08-16-2003, 12:21 AM   #5
peter72
Member
 
Registered: Oct 2002
Location: Charlottesville, VA
Distribution: Ubuntu (home), SLES (work)
Posts: 196
Blog Entries: 1

Rep: Reputation: 30
First you shouldn't ssh to another box as root, that's a BAD idea. Your system may have blocked access to root to only local machine. You can always
$ su -
to get to root once into the system.

Also you must either have the same user name as the other machine, or specify one.

$ ssh peter@myothermachine
or
$ ssh peter@192.168.0.1

It may also be you iptables are not set up to allow either ftp or ssh through. If so, you have to make sure port 20/21 and 22 are open for ftp and ssh.

Telneting into your windows box may be fun, but that is all. If you want to move data to and from a windows box, either share out a drive to the network and mount it in linux using samba, or start IIS server in windows setting up an ftp server there. (Very valnerable to all sorts of exploits, so recommended only behind a firewall on a local LAN).
 
Old 08-16-2003, 12:33 AM   #6
Ikik
LQ Newbie
 
Registered: Aug 2003
Posts: 29

Original Poster
Rep: Reputation: 15
thanks peter72,

how do i know if i have allowed the port 21/22 opened in the iptables?
and if i haven't , how can i open and configure it in the iptables?

i have tried to ssh user@othermachine as well but it still gave me error "connection refused" . Could it be something wrong with my networking setting (probably hostname, permission etc etc?)

thanks

-ik
 
Old 08-16-2003, 02:01 AM   #7
quest4knowledge
Member
 
Registered: Aug 2003
Distribution: gentoo
Posts: 62

Rep: Reputation: 15
You definately have the 2 services running. Try this as a test(run them on the server):

# ftp 127.0.0.1
# ssh 127.0.0.1

if these work then you know that the services are working correctly.

another good thing to check is:

# netstat -l

look for the ones that say beside them "LISTEN". Mine looks like this:

tcp 0 0 *:imaps *:* LISTEN
tcp 0 0 *:pop-3 *:* LISTEN
tcp 0 0 *:sunrpc *:* LISTEN
tcp 0 0 localhost:domain *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 *:smtp *:* LISTEN
tcp 0 0 *:www *:* LISTEN

well, theres more but thats the imortant things. Make sure they are not like the localhost:domain one or you wont be able to connect from outside.

If everything points to the firewall then, in my case I would use:

# /etc/init.d/iptables stop

to flush the table and set all policies to accept. you can also do this with the iptables command.

# man iptables
 
Old 08-18-2003, 10:51 PM   #8
Ikik
LQ Newbie
 
Registered: Aug 2003
Posts: 29

Original Poster
Rep: Reputation: 15
Quote:

Make sure they are not like the localhost:domain one or you wont be able to connect from outside.

errr can u explain what do you mean by "not like the localhost:domain one" ?

i can ftp and ssh localhost (127.0.0.1) but whenever i try to ssh or ftp into other machine, it always says

"ssh: connect to address 192.168.0.99 port 22: Connection refused"

any help would be appreciated

thanks

-ik
 
Old 08-18-2003, 11:14 PM   #9
quest4knowledge
Member
 
Registered: Aug 2003
Distribution: gentoo
Posts: 62

Rep: Reputation: 15
> can u explain what do you mean by "not like the localhost:domain one" ?

Sure. In the netstat output above localhost:domain is the device listening on(loopback) and the servive or port listening on (domain).

localhost:domain = 127.0.0.1:53

This is saying that for the domain service it is only listening on 127.0.0.1. If it were to look like the ssh example:

*:ssh

The "*" means that it will listen on all devices.
 
Old 08-19-2003, 12:01 AM   #10
Ikik
LQ Newbie
 
Registered: Aug 2003
Posts: 29

Original Poster
Rep: Reputation: 15
thanks for the reply

mine seems to be running already

output from netstat -l :

Code:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 *:800                   *:*                     LISTEN
tcp        0      0 *:928                   *:*                     LISTEN
tcp        0      0 *:1024                  *:*                     LISTEN
tcp        0      0 localhost.localdom:1025 *:*                     LISTEN
tcp        0      0 *:1026                  *:*                     LISTEN
tcp        0      0 *:swat                  *:*                     LISTEN
tcp        0      0 *:8200                  *:*                     LISTEN
tcp        0      0 *:netbios-ssn           *:*                     LISTEN
tcp        0      0 *:sunrpc                *:*                     LISTEN
tcp        0      0 *:10000                 *:*                     LISTEN
tcp        0      0 *:http                  *:*                     LISTEN
tcp        0      0 *:x11                   *:*                     LISTEN
tcp        0      0 *:ftp                   *:*                     LISTEN
tcp        0      0 lxserver.growths:domain *:*                     LISTEN
tcp        0      0 linuxserver.grow:domain *:*                     LISTEN
tcp        0      0 localhost.locald:domain *:*                     LISTEN
tcp        0      0 *:981                   *:*                     LISTEN
tcp        0      0 *:ssh                   *:*                     LISTEN
tcp        0      0 *:telnet                *:*                     LISTEN
tcp        0      0 *:squid                 *:*                     LISTEN
tcp        0      0 localhost.localdom:smtp *:*                     LISTEN
tcp        0      0 localhost.localdom:rndc *:*                     LISTEN
tcp        0      0 *:https                 *:*                     LISTEN
tcp        0      0 *:7741                  *:*                     LISTEN
udp        0      0 *:1024                  *:*
udp        0      0 *:nfs                   *:*
udp        0      0 *:1025                  *:*
udp        0      0 *:1026                  *:*
udp        0      0 *:1027                  *:*
udp        0      0 linuxserver.:netbios-ns *:*
udp        0      0 lxserver.gro:netbios-ns *:*
udp        0      0 *:netbios-ns            *:*
udp        0      0 linuxserver:netbios-dgm *:*
udp        0      0 lxserver.gr:netbios-dgm *:*
udp        0      0 *:netbios-dgm           *:*
udp        0      0 *:10000                 *:*
udp        0      0 *:797                   *:*
udp        0      0 *:925                   *:*
udp        0      0 lxserver.growths:domain *:*
udp        0      0 linuxserver.grow:domain *:*
udp        0      0 localhost.locald:domain *:*
udp        0      0 *:icpv2                 *:*
udp        0      0 *:7741                  *:*
udp        0      0 *:3401                  *:*
udp        0      0 *:850                   *:*
udp        0      0 *:979                   *:*
udp        0      0 *:4827                  *:*
udp        0      0 *:sunrpc                *:*
raw   102272      0 *:icmp                  *:*                     7
Active UNIX domain sockets (only servers)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ACC ]     STREAM     LISTENING     5051   public/cleanup
unix  2      [ ACC ]     STREAM     LISTENING     5058   private/rewrite
unix  2      [ ACC ]     STREAM     LISTENING     5062   private/bounce
unix  2      [ ACC ]     STREAM     LISTENING     5066   private/defer
unix  2      [ ACC ]     STREAM     LISTENING     5070   public/flush
unix  2      [ ACC ]     STREAM     LISTENING     5074   private/smtp
unix  2      [ ACC ]     STREAM     LISTENING     5078   public/showq
unix  2      [ ACC ]     STREAM     LISTENING     5082   private/error
unix  2      [ ACC ]     STREAM     LISTENING     5086   private/local
unix  2      [ ACC ]     STREAM     LISTENING     5095   private/virtual
unix  2      [ ACC ]     STREAM     LISTENING     5099   private/lmtp
unix  2      [ ACC ]     STREAM     LISTENING     5103   private/cyrus
unix  2      [ ACC ]     STREAM     LISTENING     5107   private/uucp
unix  2      [ ACC ]     STREAM     LISTENING     5111   private/ifmail
unix  2      [ ACC ]     STREAM     LISTENING     5115   private/bsmtp
unix  2      [ ACC ]     STREAM     LISTENING     5839   /tmp/.s.PGSQL.5432
unix  2      [ ACC ]     STREAM     LISTENING     8550   /tmp/ksocket-admin/kdeinit-:0
unix  2      [ ACC ]     STREAM     LISTENING     3204   /dev/gpmctl
unix  2      [ ACC ]     STREAM     LISTENING     8644   /tmp/mcop-admin/linuxserver_growthsteel_com-0e22-3f41dd97
unix  2      [ ACC ]     STREAM     LISTENING     8555   /tmp/.ICE-unix/dcop3604-1061281168
unix  2      [ ACC ]     STREAM     LISTENING     3386   /tmp/.font-unix/fs-1
unix  2      [ ACC ]     STREAM     LISTENING     8909   /tmp/orbit-admin/orb-16004743051923779293
unix  2      [ ACC ]     STREAM     LISTENING     8924   /tmp/orbit-admin/linc-e50-0-62be04e057df9
unix  2      [ ACC ]     STREAM     LISTENING     8939   /tmp/orbit-admin/orb-6816618701357260733
unix  2      [ ACC ]     STREAM     LISTENING     8665   /tmp/.ICE-unix/3625
unix  2      [ ACC ]     STREAM     LISTENING     4538   /var/lib/sasl/mux
unix  2      [ ACC ]     STREAM     LISTENING     8578   /tmp/ksocket-admin/klauncherHUze4a.slave-socket
unix  2      [ ACC ]     STREAM     LISTENING     4654   /tmp/.X11-unix/X0
still can't ssh or ftp HELPPPPP!!!
 
Old 08-20-2003, 11:55 AM   #11
stweaver
LQ Newbie
 
Registered: Aug 2003
Posts: 4

Rep: Reputation: 0
From the book "Red Hat Linux 9 for Dummies", page 119:

try the following to remove any firewall filtering you may have:

iptables --flush
iptables --flush -t nat

This book contains a pretty good introduction to Linux firewalls (for newbies like me anyway)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Help w/ FTP and SSH rules Charles Daniel Linux - Security 1 10-18-2005 10:58 PM
ftp within SSH DJOtaku Linux - Software 1 03-13-2005 09:34 PM
SSH and FTP quozt Linux - Networking 4 08-22-2003 08:10 AM
ssh and ftp artman62 Linux - Networking 4 08-25-2002 05:55 PM
FTP over SSH?? markma Linux - Security 1 12-29-2000 02:26 PM


All times are GMT -5. The time now is 04:42 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration