Linux Webserver Woes...

Discussion in 'Tech Support' started by Faulk_Wulf, 18 Feb 2010.

  1. Faulk_Wulf

    Faulk_Wulf Internet Addict

    Joined:
    28 Mar 2006
    Posts:
    402
    Likes Received:
    6
    Yet more problems. This is really annoying me.

    I downloaded and installed Ubuntu 9.04 (or 9.10?) Server, installed it using full drive with LVM or whatever, LAMP server when prompted.

    Then:
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade
    sudo apt-get install openssh-server openssh-client
    sudo shutdown -r now

    Then setup DynDNS with my Belkin router.
    (192.168.2.3 / 72.213.46.84 / arol.ath.cx)

    Set /etc/network/interfaces to:
    auto eth0
    iface eth0 inet dhcp

    installed inadyn and configured it with the following script in vi using
    sudo vi /etc/init.d/inadyn

    I restarted the server again.

    I went into the router and went to back into the router and allow Virtual Servers for:
    Ports 21, 22, 25, 80, 110 on 192.168.2.3 using TCP (?) by using the default "Add this service" option from a drop down menu.

    21 - FTP (SFTP wasn't an option on the menu)
    22 - SSH (remote desktopping)
    25 - Mail (SMTP)
    80 - HTTP (For the webpages themselves...)
    110 - Mail (POP3)

    When I try to connect using WinSCP ftp client it says "Connection Terminated, Connection Actively Refused By The Client." (I don't know whether to give it my Ubuntu user/root password or my dynDNS password, but atm, neither work.)

    And the server can't be accessed from the web.

    So. Now what? :wallbash:

    This shouldn't be rocket science. Its really annoying. I just want to throw a LAMP server up, FTP my pages up, chop the head off the server and run it all from my laptop. I do *not* see why this should take 4 hours of head bashing.

    I went Server install to cut down on the overhead, but if its going to be like this I might just install a desktop varient instead.

    Also: Please elaborate on your replies. I don't have a whole lot of Linux knowledge. I've turned to google for almost everything. From how to create a file in shell to what commands for Vi are, to about everything else.

    Thank you.

    (Edit: Server is on. You can check things yourself if you want.)
     
  2. badders

    badders Neuken in de Keuken

    Joined:
    4 Dec 2007
    Posts:
    2,635
    Likes Received:
    72
    Sounds similar to problems I had - if it's Actively refusing connections, it may be the firewall.

    Take a look here
     
  3. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    Some ISPs block priviledged ports, so that might not work. You can try port remapping, like 22022 (WAN) to 22 (LAN).

    Also, to log in, use your regular username and password, not root (it is a BAD idea to always log in as root).

    We fix it! Let's take this one step at a time... SSH, from the LAN, you should not need port forwardings and stuff like that. So, can you log in from the inside (using putty or something like it)?

    If no, check if sshd is running
    Code:
    sudo /etc/init.d/sshd start
    If that tells you it is already started, do
    Code:
    sudo netstat -taunp | grep sshd
    That should give you something like (LISTEN and :22 are important):
    Code:
    tcp        0      0 10.71.0.50:22           0.0.0.0:*               LISTEN      4405/sshd
    If that gives you the expected line, open up a terminal and do:
    Code:
    tail -f /var/log/auth.log
    and retry the login. It should tell you why it failed. (ctrl+c to exit the tail command)
     
    Last edited: 18 Feb 2010
  4. Faulk_Wulf

    Faulk_Wulf Internet Addict

    Joined:
    28 Mar 2006
    Posts:
    402
    Likes Received:
    6
    The server still has a monitor and keyboard for the time being. I have just been accessing it directly.
    '
    Setting up the server install it asked for a user name and password. When I type "sudo" and it asks for Root password I type that same password. I don't know how to separate the two as you advise.

    (How you scroll up in the server's shell? Can you? I often time end up getting like 20 lines of text that push the top of what i was reading off the screen.)

    sudo /etc/init.d/sshd start produces "command not found" but...

    your next command still worked:
    Code:
    tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 819/sshd (sshd is in red)
    tcp6 0 0 :::22 :::* LISTEN 819/sshd (in red again)
    
    tail produces several lines of:
    Code:
    Feb 18 11:17:01 Alexandria-Rose-Online CRON[1111]: pam_unix(cron:session): session opened for user root by (uid-0)
    
    Then the same thing but "closed for user root"

    Looks like one every hour for CRON 1111, 1115, 1119, 1123.

    Then two:
    Code:
    Feb 18 14:58:53:32 Alexandria-Rose-Online sudo: <username> : TTY=tty1 ; PWD=/home/<username> ; USER=root ; COMMAND=/bin/netstat -taunp
    
    (If I had to remap first, I'm sorry. I thought I'd throw this up here quick while going back through the Build Your Own Server guide on port mapping.)

    EDIT: A thought occurs. I might be trying to run a horse race, without a horse. Does a LAMP server include an FTP client server-side, or do I still need to Apt-Get one. I would suspect not having an FTP client server-side would be a good reason for it to fail...... *cough*
     
    Last edited: 18 Feb 2010
  5. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    Sudo asks for your password, not the root one.
    shift+page up/down
    oh yeah, my bad, on Debian it is called ssh, but don't bother, because...
    This shows that the server is running ;)
    Cron is the linux job scheduler, it is normal that you'll have entries ;)

    So, SSH is up and running. To log in, connect with putty and give in your username and password (not root)

    Code:
    login as: glider
    Using keyboard-interactive authentication.
    Password:
    Last login: Thu Feb 18 22:09:26 CET 2010 from 10.71.0.201 on pts/0
    glider@neptune ~ $
    These are the ones you supplied when you installed the system.

    If you do the tail command while you log in through SSH, you'll get something like following lines added in /var/log/auth.log:
    Code:
    Feb 18 22:17:00 neptune sshd[24372]: Accepted keyboard-interactive/pam for glider from 10.71.0.201 port 4619 ssh2
    Feb 18 22:17:00 neptune sshd[24372]: pam_unix(sshd:session): session opened for user glider by (uid=0)
    If that is working correctly, you can remove the screen and keyboard ;)

    Next step is Apache2, it will probably be installed because you selected LAMP. What do you get when you "browse" (in Firefox or something alike) to the IP of the server? (for instance http://10.71.0.50) Do you get an "It works!"?
     
  6. Faulk_Wulf

    Faulk_Wulf Internet Addict

    Joined:
    28 Mar 2006
    Posts:
    402
    Likes Received:
    6
    I just used Putty to shut down the computer from my laptop. I am embarrassed to say I have a very very big grin on my face for something that is probably that trivial to most people. But it made my day.

    FTP:
    http://www.bit-tech.net/bits/2007/06/05/build_your_own_server/5
    (I tried using that for FTP, when I do the restart step I get...)
    Code:
    * Stopping ftp server proftpd
    start-stop-daemon: warning failed to kill 1449: Operation not permitted (x2)
    [fail]
    rm: cannot remove `/var/run/proftpd.pid': Permission denied
    * Starting ftp server proftpd
    - notice: unable to bind to Unix domain socket at '/var/run/proftpd/test.sock': 
    Permission denied
    - notice: unable to listen to local socket: Operation not permitted
    - Fatal: SystemLog: unable to redirect logging to '/var/log/proftpd/proftpd.log': 
    Permission denided on line 91 of '/etc/proftpd/proftpd.conf'
    [fail]
    
    That to me sounds like i mistyped something in the config.

    http://72.213.46.84 and http://arol.ath.cx both deliver

    - Problem loading page

    - The connection was reset

    - The connection to the server was reset while the page was loading.

    * The site could be temporarily unavailable or too busy. Try again in a few
    moments.

    * If you are unable to load any pages, check your computer's network
    connection.

    * If your computer or network is protected by a firewall or proxy, make sure
    that Firefox is permitted to access the Web.

    Which I'm gathering means I need to configure something either with the router or LAMP.

    (I use the dynDNS service instead of No-Ip as my router supports it.)
     
  7. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    Shutting down a server is something I don't often do... Maybe once a year, max ;)

    That sounds like you didn't run it with sudo to me ;) All the permission denieds ;)

    First start with the inside (private) IP, if you get a "it works" then you need to check your port forwardings on the router. If it doesn't work, we need to tackle Apache2 ;)

    EDIT: BTW, that guide still usefull? I wrote it ages ago ;)
     
    Last edited: 18 Feb 2010
  8. Faulk_Wulf

    Faulk_Wulf Internet Addict

    Joined:
    28 Mar 2006
    Posts:
    402
    Likes Received:
    6
    Errr... Yeah, I forgot Sudo... *cough*

    http://192.168.2.3 produces the same message. (I am going over wireless with my laptop rather then directly by ethernet, does this matter?)

    ((By the way, thanks for all this personal help on this server.))
     
  9. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    Everybody made this error at least once, don't worry ;)

    Shouldn't matter if it is wireless or not... So, back to the basics (besides from kicking apache ;))

    Can you do this:
    Code:
    sudo /etc/init.d/apache2 start
    sudo netstat -taunp | grep apache
     
  10. Faulk_Wulf

    Faulk_Wulf Internet Addict

    Joined:
    28 Mar 2006
    Posts:
    402
    Likes Received:
    6
    Command not found. (And thus, second command returns nothing.)

    So...

    sudo apt-get install apache2 ?
     
  11. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    First see if it is installed ;)
    Code:
    sudo dpkg -l | grep apache
    If not, indeed install it by
    Code:
    sudo apt-get update && sudo apt-get install apache2
     
  12. Faulk_Wulf

    Faulk_Wulf Internet Addict

    Joined:
    28 Mar 2006
    Posts:
    402
    Likes Received:
    6
    So. I banged my head because I didn't have Apache installed? ... Wow, just wow.

    But I got "It Works!" Locally, by ip, and by domain.

    Is PHP, phpMyAdmin, etc all seperate downloads or were they included in that bundle?

    Aside from that, everything appears to be in order, thank you so much.
     
  13. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    All different ones. You can get their package names by issuing
    Code:
    sudo apt-cache search php
    If the list is too long, you can 'pipe' it to a pager, eg less

    Code:
    sudo apt-cache search <keyword> | less
    (q to quit less)

    EDIT: You can also search in less, "/<keyword>", and "n" for next hit ;)
     
  14. Faulk_Wulf

    Faulk_Wulf Internet Addict

    Joined:
    28 Mar 2006
    Posts:
    402
    Likes Received:
    6
    :) Yay!

    Thanks again.
     
  15. Faulk_Wulf

    Faulk_Wulf Internet Addict

    Joined:
    28 Mar 2006
    Posts:
    402
    Likes Received:
    6
    I was wrong. I can access the webserver using the local IP, public IP, and url, but not from anything other then the networked laptop. (Its connected wirelessly to the same router that the server is connected to by ethernet.)

    (I get the Apache "It works!" page.)

    I can use Putty to access the server from my laptop, or any device (including my phone) with no problem. I have installed packages from a couple of machines now.

    I can only access Webmin by the local IP.

    I have tried using:
    http://www.bit-tech.net/bits/2007/07/24/build_your_own_better_server/4
    this page to redirect FTP and HTTP.

    2121 and 8080 respectively.

    2121 doesn't help at all with FTP, it keeps saying "Connection actively refused by the server" no matter what I do. If I tell Webmin to listen for 2121 and have the router listen for 21 in and send it out to 2121, nothing. even if i actively SEND to 2121, have it listen for 2121 and ship it to 2121 it does nothing.

    When I try to tell the router to listen to 8080, it hangs, reboots, and kills my internet connection. If I wait 5 - 10 minutes I can reach the router through my browser wirelessly, but it isn't until i reset it to 80 listen that it lets me back online. Trying to access it from my phone browser (arol.ath.cx:8080) with the router listening for both didn't help and it wouldn't reach from the url with 80 sending to local ip :8080 and webmin listening.

    In short, everything works inside. But no one can reach it outside. I get that this has something to do with the ports, but I can't seem to get it to listen to the new port numbers like its supposed to.

    My router is a Belkin FSD7234-4 v3
    Webmin is 1.500
    Server is Ubuntu 9.04 (or 9.10?) Server Edition

    Side Note: I can't login to the CGI module. It denies my username and password even if I set the user/pw manually in the config-tool.

    Thoughts?
     
  16. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    Well FTP is kind of a special protocol. It won't probably work to remap it. FTP uses 2 ports, 1 for the control connection and 1 for the data connection.

    8080 again is a special port with most ISPs. 8080 is often a proxy port, and therefor also blocked. But have you tried if 80 itself is blocked?

    Oh-oh... Belkin... Never had good luck with Belkin...
    Not a single clue about this one. I do my administration CLI, only played around with webmin for the guide (I think the full 20 mins) and hated it TBH ;)
     
  17. koola

    koola Minimodder

    Joined:
    11 Jul 2004
    Posts:
    2,401
    Likes Received:
    10
    Depends which ftpd you're using, I use vsftpd passive and active without any issues.

    https://help.ubuntu.com/6.06/ubuntu/serverguide/C/ftp-server.html

    For the WAN port, would be tempted to set in the range 1000 ~ 4000. If you still get server disconnect, put your pc as the WAN gateway and try login to ftp. Wire shark on win is useful for debugging.
     
  18. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    FTP will only work through NAT if an ALG is handling the PORT and PASV requests. I am 99% sure that a Crapkin router doesn't. At work (I am a router tester and my feature is FTP ALG ;)) I used vsftpd, proftpd, ... and they all required the ALG to work in active mode. in PASV mode you can get away with it, if your router doesn't do port translation.
     
  19. Faulk_Wulf

    Faulk_Wulf Internet Addict

    Joined:
    28 Mar 2006
    Posts:
    402
    Likes Received:
    6
    Well I can remove Webmin. I actually confused it with myPHPAdmin.

    So I need to pick a random port number for web other then 80 / 8080? (because it doesn't work on either outside of the network) Something like 2280?

    Could the problem be I'm using winSCP Portable from the PortableApps website to try and connect?

    EDIT: I have tried mapping it to a bunch of ports. 1111, 2222, 2223, 8080, and several others. No luck. With HTTP or FTP. But I have no problem with SSH. Is it really the router's fault? Belkin is just so stupid that you can't set up a simple webserver because of the brand?

    I even switched to No-Ip for the DNS service. Didn't help.

    The computer works. I can access everything LOCALLY. (192.168.2.3 returns the "It works" page still.)

    I'm willing to start 100% from scratch here. I just want this to work.
     
    Last edited: 21 Feb 2010
  20. Zoon

    Zoon Hunting Wabbits since the 80s

    Joined:
    12 Mar 2001
    Posts:
    5,497
    Likes Received:
    630
    Just to check - are you trying to SSH as root, or as another user?

    Root login via SSH is usually disabled, which will block SCP connections too therefore.
     

Share This Page