Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 initialize ssh, already tried reinstall.

SSH server is started manually via /etc/init.d/ssh start

netstat -nlp shows that no services are running at tcp port 22

share|improve this question
    
Could you clarify in your question if you have tried starting it manually, ie sudo /etc/init.d/ssh start, and if so, did it give a different error than when you installed? Also, maybe you would want to install nmap and run nmap 127.0.0.1 to see if there is already a instance of ssh running and put the result in your question. –  Azendale Jul 17 '11 at 20:21
    
i tried to run it manually, and got the same thing –  Frielspak Jul 17 '11 at 23:14
    
Try to start once again the ssh daemon manually and then open /var/log/auth and check at the bottom of the file what the logs show... –  Pavlos G. Aug 22 '11 at 10:59

2 Answers 2

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
    
This only fixes it for the current session. After a reboot that directory will be gone. –  Malfist Nov 18 '13 at 4:28

There seem to be 3 issues resulting in this behavior (for my system Ubuntu 14.04LTS):

1- ssh unknown job occurs when you try to use 'service ssh start' from a 'su' session. Solution is to use sudo service start from a logged in user that can 'sudo'

2- The existing init.d/ssh script is exiting quietly without actually starting sshd when ssh is on upstart

3- The main reason ssh does not start is because on Ubuntu 14.04 there is an empty file /etc/ssh/sshd_host_not_to_run which indicates that sshd should not run. Just delete that file if you want sshd to run.

So overall solution is: Use sudo service ssh start after deleting /etc/ssh/sshd_host_not_to_run

share|improve this answer

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.