Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Ssh connection has stopped listening on a linux server, the output of nmap is

PORT     STATE SERVICE
21/tcp   open  ftp
80/tcp   open  http
199/tcp  open  smux
443/tcp  open  https
5000/tcp open  upnp
9102/tcp open  jetdirect

is there a way to enable ssh remotely?

share|improve this question
add comment

4 Answers

up vote 3 down vote accepted

You need access to the console of the linux machine to start the ssh service again- this may involve you logging a ticket with your hosting provider. A reboot may not fix this- if the service is not set to start on bootup.

share|improve this answer
add comment

You're probably out of luck. If those services are even close to properly configured, they're not going to give you the access that you need. You might be looking at a reboot, if nothing else works.

share|improve this answer
    
That is my initial gut feeling that I cannot skip the trip to the server room :( –  Chris-Top Jan 26 '11 at 13:12
    
Agreed. Unless you're running webmin or plesk or something else that allows service control through a web interface, then you're stuck except for local console access. –  SmallClanger Jan 26 '11 at 14:28
add comment

More than likely, if SSH was working and now it's not AND it is no longer listening, then (more than likely), you do NOT need to reboot. You either need to get to the console (non SSH), log a ticket with Support with your hosting provider, or have someone console the system for you. I suspect that SSH might be hung and just needs to be restarted (sometimes you might have to kill the old ssh PID to get the restart to work, depending how bad SSH hangs - and if that doens't work, you might have to remove the SSH lock file if things really get into hand). With Linux distros, it's rare you reboot because of a software issue - theres usually many ways around it by use of command line tools.

If there is a remote reboot option, I don't recommend it, however, if it's your only way, use at your own risk.

share|improve this answer
add comment

Since you have FTP and HTTP access, if you have PHP or another scripting language on your system you could upload a document like this to give you a shell as the webserver user:

<?php
echo "starting shell<br>";
system("cd /tmp; mkfifo fifo; nc -l 2000 <fifo | bash -i &> fifo ; rm fifo");
echo "done<br>";
?>

Unfortunately, you will not have a controlling terminal so you won't be able to run "su" to restart sshd.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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