Awkward problem: for some reason, I can't reach our Linux server by SSH. Everything else works. Since it doesn't have a graphics card (I had to remove it to make room for another NIC) I can only control it "blindly" by typing on the keyboard.

By typing blindly I managed to eliminate the firewall as an issue by deactivating it. I rebooted the server but SSH doesn't seem to come up at all.

Now I managed to initiate a SSH connection from the server to my workstation. Is there any way I can hijack that connection to get a terminal on the server that I can control from my workstation? Using a tunnel doesn't work since the SSH daemon doesn't start at all.

The server is an Ubuntu 8.04 LTS box, my workstation is Ubuntu 11.04. On the server, the following software is running:

  • Apache with mod_php
  • BIND
  • FTP
  • CUPS
  • Postgres
  • MySQL
  • SANE
  • Is there any problem using one NIC with multiple IPs (eg use as Proxy or Firewall as service for others)? – mbx Jun 7 '11 at 11:13
  • Well, I could always take out the NIC, put it a video card and do everything from the console but I'm trying to avoid the downtime. – Jonas Jun 7 '11 at 11:24
  • 1
    If you can access the hole filesystem via php or ftp via remote, there is a chance to place a script to started from cron. Or you could try to exploit (other) security holes if your late with security patches (bind comes in mind). – mbx Jun 7 '11 at 11:32
  • Thanks, that put me on the right track! I managed to upload phpshell (phpshell.sf.net) and "luckily" an unsafe sudo-configuration allowed me to get a root shell. The problem was a bad SSH configuration directive that someone left in that surfaced because of a reboot. – Jonas Jun 7 '11 at 11:39
  • @Jonas: Since you already solved it, you won't need it anymore but for completeness: Metasploit eases the search. – mbx Jun 7 '11 at 11:46

You can setup a reverse proxy SSH tunnel like so:

(blindly) from the server, you need to SSH out to another box running an ssh daemon (like Linux, Mac, or WinSSHD):

ssh -R 9999:localhost:22 otherboxuser@other.box.IP.address

port 9999 is just an arbitrary/unused port.

Now you can SSH from your other box to the blind server by tunneling through the connection you're already established:

ssh localhost -p 9999

Get yourself a USB video card dongle or find a video card that'll fit in whatever slot you have remaining.

| improve this answer | |
  • 2
    Thanks for the USB video card tip. Opening a tunnel doesn't work since the SSH deamon doesn't seem to run at all on the server. – Jonas Jun 7 '11 at 11:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.