2

ssh is installed in my system.

      ssh -V
OpenSSH_6.6.1p1 Ubuntu-2ubuntu2, OpenSSL 1.0.1f 6 Jan 2014

But when I try to uninstall it completely using sudo apt-get purge openssh-server it says Package 'openssh-server' is not installed, so not removed. How I can remove it completely? I was having issue SSH login using Ubuntu's terminal - Permission denied (publickey), so I wanted to un-install it and again re-install it.

As suggested by Mark in the answer/comments, I've uninstalled ssh using synaptic package manager, still ssh -V was showing it's there. What might be the issue?

enter image description here

As suggested, again I've reinstalled it, still I'm getting SSH login using Ubuntu's terminal - Permission denied (publickey) issue.

While searching for ssh in synaptic package manager, when ssh is installed, instead of showing ssh meta package, it shows something like the attached image. enter image description here

  • 3
    ssh server isn't installed by default, ssh server has to be manually installed. What you have is the client, the thing that allows going from the box to another box. Mark's answer suits you the most – Sergiy Kolodyazhnyy Aug 5 '15 at 6:28
  • @markkirby: Sorry about the confusion. I've updated the question. – amitshree Aug 6 '15 at 5:59
  • 1
    @amitshree That one called ssh is the meta package, the description should say secure shell client and server (metapackage), It says it is installed any way, I am going too post on your other question as that is the real issue here. Thanks for updateing – Mark Kirby Aug 6 '15 at 6:29
5

On my system the package openssh-server is not installed, it is called openssh-client

sudo apt-get purge openssh-client

If it is still there

dpkg --listfiles openssh-client

Will give you the locations and name of all openssh-client packages

After looking around, openssh has many preinstalled packages, removing the client alone did not remove ssh from the system, however here is a way to get rid of it all

First you need synaptic package manager

sudo apt-get install synaptic

Open this, enter password and in the search box put ssh, now, you see the package just called ssh ? That is an ssh meta package, uninstalling this should remove ssh from the system completely.

enter image description here

  • Faster than me =) +1 – A.B. Aug 5 '15 at 6:27
  • @mark: sudo apt-get purge openssh-client says E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it? – amitshree Aug 5 '15 at 6:29
  • You are using another package manager at the same time, please make sure apt is only running once – Mark Kirby Aug 5 '15 at 6:29
  • 2
    Make sure that synaptic, system update, and others are not running. – Mitch Aug 5 '15 at 6:30
  • @markkirby: Ok, Now I was able to purge using openssh-client. Still ssh -V says it's there. dpkg --listfiles openssh-client gives /. /etc /etc/ssh /etc/ssh/moduli /etc/ssh/ssh_config /usr /usr/lib /usr/lib/openssh /usr/lib/openssh/ssh-keysign /usr/lib/openssh/ssh-pkcs11-helper /usr/share /usr/share/doc /usr/share/doc/openssh-client etc. – amitshree Aug 5 '15 at 6:37
2

The command ssh is part of the package openssh-client

Therefore remove it with

sudo apt-get purge openssh-client
1

You have the client. To be sure, type the following:

dpkg -l | grep openssh-client

Note that the client is harmless. It is for you to tunnel into other machines. It doesn't include an SSH server that would give an attacker (or anyone) SSH access to your computer.

  • it gives something like ii libssh-4:amd64 0.6.1-0ubuntu3.1 amd64 tiny C SSH library – amitshree Aug 5 '15 at 6:20
  • Ok - not the client but a library. In any case, you don't have the server installed. As for what the library is for, I don't know. – Simon Hoare Aug 5 '15 at 6:33
0

You need to stop the ssh service before un-installing it. Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

sudo /etc/init.d/ssh stop

or

sudo service ssh stop

Then do

sudo apt-get --purge remove openssh-client openssh-server
  • Sorry @Mitch, but I don't understand. The error message in OPs question is Package 'openssh-server' is not installed, so not removed – A.B. Aug 5 '15 at 6:25
  • sudo service ssh stop says ssh: unrecognized service. Why so?? – amitshree Aug 5 '15 at 6:26
  • What about the first command? – Mitch Aug 5 '15 at 6:27
  • first command says sudo: /etc/init.d/ssh: command not found – amitshree Aug 5 '15 at 6:29
  • You may have removed it, or its not running. – Mitch Aug 5 '15 at 6:31

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.