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.

Setting up openssh-server (1:5.3p1-3ubuntu7) ... Creating SSH2 RSA key; this may take some time ... Creating SSH2 DSA key; this may take some time ... start: Job failed to start

can't inicialize ssh, already tried reinstall.

netstat -tlnp shows that no service is running on tcp port 22

share|improve this question
    
Going to the basics... are you running as root or using sudo when you try to start it? Did you edit the configuration file and now there are possible errors in the configuration? What command did you run to get the output you posted above? Have you checked your log files? –  Safado Sep 14 '11 at 21:55
add comment

3 Answers

You've not provided much information but some common reasons why a service fails to start are:

  • If there is something already listening on port 22; Do a netstat -tlnp to see if there is something listening on port 22.
  • If there is insufficient memory. Do a free -m to ensure that there is sufficient memory free.

You can possibly try starting it manually to see if it works or shows more error messages. Check your log files.

Run /etc/init.d/sshd restart to see.

share|improve this answer
    
running it manually says the same thing more: you can use upstart to start ssh, start ssh, but gives the same error, with service it give the same error too –  Frielspak Jul 17 '11 at 23:15
    
What does the netstat and free show? –  sybreon Jul 21 '11 at 2:00
add comment

Not sure that my solution is right. But if you just want to start your SSH server and then solve your problem later, here is my fast solution:

start-stop-daemon --start --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- -p 22

if then you will see error:

Missing privilege separation directory: /var/run/sshd

then just create that missing directory, and try above start-stop-daemon command again:

mkdir /var/run/sshd
chmod 0755 /var/run/sshd

that helped me to start my sshd daemon.

share|improve this answer
add comment

If your machine is a VPS which runs in an OpenVZ container, then try to comment out the "oom never" line in the /etc/init/ssh.conf file.

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.