Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I had installed ssh but something went wrong and I uninstalled it. I removed the SSH configuration files by hand (I deleted all /etc/ssh folder).

After ssh installation (I mean apt-get install ssh) I noticed that I have no SSH configuration files.

I tried apt-get install openssh-server but i still have no SSH configuration files.

share|improve this question

migrated from stackoverflow.com Jun 3 '11 at 20:30

This question came from our site for professional and enthusiast programmers.

4  
Thanks for the loads of information. You told us which configuration files you've deleted and whether the machine in question was a server or desktop. –  Lekensteyn Jun 3 '11 at 20:28
    
All configuration files :(. I think it is desktop version but I do not know for sure. It is Debian 6.1.0 Squeeze –  Seven Jun 3 '11 at 20:37
    
All configuration files? Did you mean you wiped the whole /etc directory? Or just /etc/ssh? Does ls -A /etc and l -lA /etc/ssh show any results? Do you mean an "installation over SSH" or an "installation of SSH" (openssh-server or openssh-client?)? –  Lekensteyn Jun 3 '11 at 20:41
    
You should add these details to the question by using the "edit" button below the question's tags. I suggest reinstalling both the client and the server just to be safe. –  new123456 Jun 3 '11 at 20:45
add comment

2 Answers 2

up vote 3 down vote accepted

apt-get install openssh-server just installs the openssh-server package if it wasn't previously installed. To reinstall it, run:

sudo apt-get --reinstall install openssh-server

The package ssh is a meta-package that depends both on openssh-server and openssh-client packages, so removing it does not remove the two.

share|improve this answer
    
Thanks. Is alive ;) –  Seven Jun 3 '11 at 21:06
add comment

if you have removed /etc/ssh altogether, before running sudo apt-get --reinstall install openssh-server you have to recreate the directory /etc/ssh and a file sshd_config in it if I am to believe my /var/lib/dpkg/info/openssh-server.postinst where I can read :

    #Preserve old sshd_config before generating a new one
    if [ -e /etc/ssh/sshd_config ] ; then 
        mv /etc/ssh/sshd_config /etc/ssh/sshd_config.dpkg-old
    fi

    cat <<EOF > /etc/ssh/sshd_config

unfortunately, that didn't do the trick for me (my settings were lost during an upgrade) I have to fix sshd_config, I am blocked with

   debug2: ssh_connect: needpriv 0
   debug1: Connecting to  xxx.com [XXX.XXX.XXX.XXX] port 22.
   debug1: Connection established.
   debug1: identity file /home/dan/.ssh/id_rsa type -1
   debug1: identity file /home/dan/.ssh/id_rsa-cert type -1
   debug1: identity file /home/dan/.ssh/id_dsa type -1
   debug1: identity file /home/dan/.ssh/id_dsa-cert type -1
   debug1: Remote protocol version 2.0, remote software version OpenSSH_5.5p1 Debian-6
   debug1: match: OpenSSH_5.5p1 Debian-6 pat OpenSSH*
   debug1: Enabling compatibility mode for protocol 2.0
   debug1: Local version string SSH-2.0-OpenSSH_5.5p1 Debian-6
   debug2: fd 3 setting O_NONBLOCK
   debug1: SSH2_MSG_KEXINIT sent

I don't have any prompt back Lucky me :( http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=613505

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.