LinuxQuestions.org
Review your favorite Linux distribution.
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 08-10-2009, 12:35 AM   #1
johnh10000
Member
 
Registered: Nov 2008
Distribution: Ubuntu Lucid Lynx
Posts: 541

Rep: Reputation: 33
two servers sort of


Hi gang,

I have just come back off holiday, and repaired my broken mail server, which was easy, just didn't have time b4 hols. I moved it to another box on my network, which is rapidly becoming my server box. JUanty.

My main box, (terminal) also running jaunty, is my annon ftp server, which works fine. As my website is now be served from tux2, I need user ftp on that box to uplaod photos and the like, for the webiste.

Now to explain, I have one IP numeber, and dynadns so tux.isa-geek.org and tux2... basicly resolve to the same place. So I ask my router to port forward, mail stuff to 192.168.1.4 (tux2) and annon ftp to 192.168.1.3 (tux)

So I have setup port 90-91 to be tux2's ftp.
I have changed services ftp bit to 90 and 91
and chaged proftpd's port number to 90.

but can't connect any ideas?

Resolving address of tux2.isa-geek.org
Status: Connecting to 82.6.x.x:91...
Status: Connection attempt failed with "ECONNREFUSED - Connection refused by server".
Error: Could not connect to server

---
also I used NX while I was away, to logon, to update the website, this uses ssh. fine. But to connect to tux, how would I change the ssh port of tux?
 
Old 08-10-2009, 02:08 AM   #2
settntrenz
Member
 
Registered: Aug 2009
Location: Orlando, Florida
Distribution: RHEL, Ubuntu
Posts: 49

Rep: Reputation: 19
A good starting point might be to determine whether or not the server is listening on the new port.

Code:
lsof -i tcp:91
I think you mentioned you are using ubuntu, in that case add sudo in front of lsof.

Code:
sudo lsof -i tcp:91
I don't have an FTP server running on port 91, I do however have an ssh server running on port 22. Here is what the output should look like

Code:
user@hostname:~$ sudo lsof -i tcp:22
[sudo] password for user: 
COMMAND  PID USER   FD   TYPE DEVICE SIZE NODE NAME
sshd    2877 root    3u  IPv4   6704       TCP *:ssh (LISTEN)
sshd    2877 root    4u  IPv6   6707       TCP *:ssh (LISTEN)
If nothing is listening you won't get any output at all. Try restarting the ftp daemon if you haven't already and re-run the command. If that doesn't fix it, look into your config file.

If it is listening, you might want to make sure iptables is allowing that traffic into the server. You can either post your iptables output here, try telnet'ing to port 91 from a remote machine, or port scanning the box with nmap assuming that is legal where you are.

If the server is listening and remote connections are allowed through the firewall, it is going to be an issue with FTP and control ports which can be a bit tricky. Are you running active or passive FTP?

the ssh port is configured in /etc/ssh/sshd_config. Specifically, the "Port" line. This will require you to restart the daemon and because the port is changing, you will get booted if remotely administrating the server. Don't forget to make the proper changes to iptables as well so you can get back in.

Last edited by settntrenz; 08-10-2009 at 02:12 AM.
 
Old 08-10-2009, 03:32 AM   #3
johnh10000
Member
 
Registered: Nov 2008
Distribution: Ubuntu Lucid Lynx
Posts: 541

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by settntrenz View Post
A good starting point might be to determine whether or not the server is listening on the new port.

Code:
lsof -i tcp:91
I think you mentioned you are using ubuntu, in that case add sudo in front of lsof.

Code:
sudo lsof -i tcp:91

If it is listening, you might want to make sure iptables is allowing that traffic into the server. You can either post your iptables output here, try telnet'ing to port 91 from a remote machine, or port scanning the box with nmap assuming that is legal where you are.

If the server is listening and remote connections are allowed through the firewall, it is going to be an issue with FTP and control ports which can be a bit tricky. Are you running active or passive FTP?

the ssh port is configured in /etc/ssh/sshd_config. Specifically, the "Port" line. This will require you to restart the daemon and because the port is changing, you will get booted if remotely administrating the server. Don't forget to make the proper changes to iptables as well so you can get back in.
well here are my results: from telnet

johnh10000@tux:~$ telnet tux2.isa-geek.org 91
Trying 82.6.134.175...
telnet: Unable to connect to remote host: Connection refused
johnh10000@tux:~$ telnet tux2.isa-geek.org 90
Trying 82.6.134.175...
telnet: Unable to connect to remote host: Connection refused
johnh10000@tux:~$

and from lsof:
root@tux2:/home# lsof -i tcp:90
root@tux2:/home# lsof -i tcp:91
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
inetutils 2461 root 5u IPv6 5925 TCP *:ftp (LISTEN)
root@tux2:/home#

which sugests the iptables need to be updated. A clue how to do this would be nice please. I'll change my mail notifier, it didn't tell me you'd replied

thanks
 
Old 08-10-2009, 04:00 AM   #4
johnh10000
Member
 
Registered: Nov 2008
Distribution: Ubuntu Lucid Lynx
Posts: 541

Original Poster
Rep: Reputation: 33
I tried your change the ssh config file on tux. When I tried to ssh over to tux2, it complianed, that tux2's ssh wasn't on port 92. I want tux on 92.

Will report bak in a min as I've changed iptables now. Found it on the net via google.

sudo iptables -A INPUT -p tcp --dport 91 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 90 -j ACCEPT

yeah?
 
Old 08-10-2009, 04:03 AM   #5
johnh10000
Member
 
Registered: Nov 2008
Distribution: Ubuntu Lucid Lynx
Posts: 541

Original Poster
Rep: Reputation: 33
Status: Waiting to retry...
Status: Resolving address of tux2.isa-geek.org
Status: Connecting to 82.6.134.175:90...
Error: Connection attempt interrupted by user
Status: Resolving address of tux2.isa-geek.org
Status: Connecting to 82.6.134.175:91...
Status: Connection attempt failed with "ECONNREFUSED - Connection refused by server".
Error: Could not connect to server
Status: Waiting to retry...
Error: Connection attempt interrupted by user

well whatever I've done hasn't worked.

I await more input, from you guys!
 
Old 08-10-2009, 11:15 AM   #6
settntrenz
Member
 
Registered: Aug 2009
Location: Orlando, Florida
Distribution: RHEL, Ubuntu
Posts: 49

Rep: Reputation: 19
Quote:
Originally Posted by johnh10000 View Post
Status: Waiting to retry...
Status: Resolving address of tux2.isa-geek.org
Status: Connecting to 82.6.134.175:90...
Error: Connection attempt interrupted by user
Status: Resolving address of tux2.isa-geek.org
Status: Connecting to 82.6.134.175:91...
Status: Connection attempt failed with "ECONNREFUSED - Connection refused by server".
Error: Could not connect to server
Status: Waiting to retry...
Error: Connection attempt interrupted by user

well whatever I've done hasn't worked.

I await more input, from you guys!

Can you paste the output of

Code:
sudo iptables -L -n --line-numbers
so we can have a look.
 
Old 08-10-2009, 01:07 PM   #7
johnh10000
Member
 
Registered: Nov 2008
Distribution: Ubuntu Lucid Lynx
Posts: 541

Original Poster
Rep: Reputation: 33
As requested.

root@tux2:~# iptables -L -n --line-numbers
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ufw-before-logging-input all -- 0.0.0.0/0 0.0.0.0/0
2 ufw-before-input all -- 0.0.0.0/0 0.0.0.0/0
3 ufw-after-input all -- 0.0.0.0/0 0.0.0.0/0
4 ufw-after-logging-input all -- 0.0.0.0/0 0.0.0.0/0
5 ufw-reject-input all -- 0.0.0.0/0 0.0.0.0/0

Chain FORWARD (policy DROP)
num target prot opt source destination
1 ufw-before-logging-forward all -- 0.0.0.0/0 0.0.0.0/0
2 ufw-before-forward all -- 0.0.0.0/0 0.0.0.0/0
3 ufw-after-forward all -- 0.0.0.0/0 0.0.0.0/0
4 ufw-after-logging-forward all -- 0.0.0.0/0 0.0.0.0/0
5 ufw-reject-forward all -- 0.0.0.0/0 0.0.0.0/0

Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
1 ufw-before-logging-output all -- 0.0.0.0/0 0.0.0.0/0
2 ufw-before-output all -- 0.0.0.0/0 0.0.0.0/0
3 ufw-after-output all -- 0.0.0.0/0 0.0.0.0/0
4 ufw-after-logging-output all -- 0.0.0.0/0 0.0.0.0/0
5 ufw-reject-output all -- 0.0.0.0/0 0.0.0.0/0

Chain ufw-after-forward (1 references)
num target prot opt source destination

Chain ufw-after-input (1 references)
num target prot opt source destination
1 RETURN udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:137
2 RETURN udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:138
3 RETURN tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:139
4 RETURN tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:445
5 RETURN udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:67
6 RETURN udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:68
7 RETURN all -- 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type BROADCAST

Chain ufw-after-logging-forward (1 references)
num target prot opt source destination

Chain ufw-after-logging-input (1 references)
num target prot opt source destination

Chain ufw-after-logging-output (1 references)
num target prot opt source destination

Chain ufw-after-output (1 references)
num target prot opt source destination

Chain ufw-before-forward (1 references)
num target prot opt source destination
1 ufw-user-forward all -- 0.0.0.0/0 0.0.0.0/0

Chain ufw-before-input (1 references)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
2 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
3 ufw-logging-deny all -- 0.0.0.0/0 0.0.0.0/0 state INVALID
4 DROP all -- 0.0.0.0/0 0.0.0.0/0 state INVALID
5 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 3
6 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 4
7 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 11
8 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 12
9 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 8
10 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp spt:67 dpt:68
11 ufw-not-local all -- 0.0.0.0/0 0.0.0.0/0
12 ACCEPT all -- 224.0.0.0/4 0.0.0.0/0
13 ACCEPT all -- 0.0.0.0/0 224.0.0.0/4
14 ufw-user-input all -- 0.0.0.0/0 0.0.0.0/0

Chain ufw-before-logging-forward (1 references)
num target prot opt source destination

Chain ufw-before-logging-input (1 references)
num target prot opt source destination

Chain ufw-before-logging-output (1 references)
num target prot opt source destination

Chain ufw-before-output (1 references)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW,RELATED,ESTABLISHED
3 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 state NEW,RELATED,ESTABLISHED
4 ufw-user-output all -- 0.0.0.0/0 0.0.0.0/0

Chain ufw-logging-allow (0 references)
num target prot opt source destination

Chain ufw-logging-deny (2 references)
num target prot opt source destination

Chain ufw-not-local (1 references)
num target prot opt source destination
1 RETURN all -- 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type LOCAL
2 RETURN all -- 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type MULTICAST
3 RETURN all -- 0.0.0.0/0 0.0.0.0/0 ADDRTYPE match dst-type BROADCAST
4 ufw-logging-deny all -- 0.0.0.0/0 0.0.0.0/0 limit: avg 3/min burst 10
5 DROP all -- 0.0.0.0/0 0.0.0.0/0

Chain ufw-reject-forward (1 references)
num target prot opt source destination

Chain ufw-reject-input (1 references)
num target prot opt source destination

Chain ufw-reject-output (1 references)
num target prot opt source destination

Chain ufw-user-forward (1 references)
num target prot opt source destination

Chain ufw-user-input (1 references)
num target prot opt source destination
1 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:90
2 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:90
3 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:91
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
5 ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:22

Chain ufw-user-limit (0 references)
num target prot opt source destination
1 LOG all -- 0.0.0.0/0 0.0.0.0/0 limit: avg 3/min burst 5 LOG flags 0 level 4 prefix `[UFW LIMIT BLOCK] '
2 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-port-unreachable

Chain ufw-user-limit-accept (0 references)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0

Chain ufw-user-logging-forward (0 references)
num target prot opt source destination

Chain ufw-user-logging-input (0 references)
num target prot opt source destination

Chain ufw-user-logging-output (0 references)
num target prot opt source destination

Chain ufw-user-output (1 references)
num target prot opt source destination
root@tux2:~#
 
Old 08-10-2009, 02:54 PM   #8
settntrenz
Member
 
Registered: Aug 2009
Location: Orlando, Florida
Distribution: RHEL, Ubuntu
Posts: 49

Rep: Reputation: 19
PM sent
 
Old 08-10-2009, 03:16 PM   #9
johnh10000
Member
 
Registered: Nov 2008
Distribution: Ubuntu Lucid Lynx
Posts: 541

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by settntrenz View Post
PM sent
did a reset of the router, still no joy
 
Old 08-10-2009, 03:31 PM   #10
settntrenz
Member
 
Registered: Aug 2009
Location: Orlando, Florida
Distribution: RHEL, Ubuntu
Posts: 49

Rep: Reputation: 19
Quote:
Originally Posted by johnh10000 View Post
and from lsof:
root@tux2:/home# lsof -i tcp:90
root@tux2:/home# lsof -i tcp:91
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
inetutils 2461 root 5u IPv6 5925 TCP *:ftp (LISTEN)
I just noticed that your lsof output only mentions listening on an ivp6 address. Sorry I missed that earlier. Looks like the problem might be with the FTP configuration. I'm not super familiar with inetutils on ubuntu. I'm going to play around with it and see if I can install and get it listening on a non-standard port. I'll get back to you.
 
Old 08-10-2009, 04:03 PM   #11
johnh10000
Member
 
Registered: Nov 2008
Distribution: Ubuntu Lucid Lynx
Posts: 541

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by settntrenz View Post
I just noticed that your lsof output only mentions listening on an ivp6 address. Sorry I missed that earlier. Looks like the problem might be with the FTP configuration. I'm not super familiar with inetutils on ubuntu. I'm going to play around with it and see if I can install and get it listening on a non-standard port. I'll get back to you.
Cheers I don't need the ivp6 bit.
 
Old 08-11-2009, 06:51 AM   #12
johnh10000
Member
 
Registered: Nov 2008
Distribution: Ubuntu Lucid Lynx
Posts: 541

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by johnh10000 View Post
Cheers I don't need the ivp6 bit.
Thanks for all your help.

As you suggested, it was a proftpd config problem. now using vsftpd, and it works, how I want it.

cheers
 
Old 08-11-2009, 11:10 AM   #13
settntrenz
Member
 
Registered: Aug 2009
Location: Orlando, Florida
Distribution: RHEL, Ubuntu
Posts: 49

Rep: Reputation: 19
Quote:
Originally Posted by johnh10000 View Post
Thanks for all your help.

As you suggested, it was a proftpd config problem. now using vsftpd, and it works, how I want it.

cheers
After messing with inetutils I was going to recommend that you switched to vsftpd. It's much easier (in my opinion) to work with. Glad it is working for you!
 
  


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
Can I use GNU sort to sort one field in order, another in reverse? zombieite Linux - Newbie 4 04-27-2009 12:23 AM
php sort help - sort numerical descending then by alphabetical? RavenLX Programming 3 03-11-2009 08:35 AM
selection sort compiles but does not sort the array as desired ganesha Programming 2 04-20-2008 07:44 AM
Some sort of Authentication (ssl, what ever) between apache servers helptonewbie Linux - Server 4 02-19-2008 10:33 AM
Is there a line limit with the sort utility? Trying to sort 130 million lines of text gruffy Linux - General 4 08-10-2006 08:40 PM

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

All times are GMT -5. The time now is 10:48 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