Question

Cannot install SSH.

Posted April 16, 2018 5.4k views
DigitalOcean Ubuntu 16.04

The password for one of our user names wasn’t allowing us to login. We changed the password, but had the issue again.
In attempt to fix this I reset the SSH. Now ssh will not reinstall.

When trying to re-install the server we get the following errors

“Openssh-server” has no installation candidate"
and
“Package openssh-server is not available, but is referred to by another package. This may mean the the package is missing, has been obsolete , or is only available from another source.

E: Unable to locate package ssh
E: Package ‘openssh-server” has no installation candidate

1 comment
  • hi while performing ssh command on Vmware workstation 14, my command sudo apt-get install ssh is not working its showing dataflair@dataflair-virtual-machine:~$ sudo apt-get install ssh
    [sudo] password for dataflair:
    its not proceeding further plz help out,even i used rm -rf /var/lib/apt/lists/lock but still my problem is same
    dataflair@dataflair-virtual-machine:~$ rm -rf /var/lib/apt/lists/lock
    rm: cannot remove ’/var/lib/apt/lists/lock’: Permission denied
    please help out soon its imideatley required

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

2 answers

if you use ubuntu 16.04 or debian jessie OS than double check your sourcelist

step 1
Debian sourcelist sourcelist

deb http://ftp.de.debian.org/debian/ jessie main non-free contrib
deb-src http://ftp.de.debian.org/debian/ jessie main non-free contrib

deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

ubuntu 1604 xenial sourcelist

deb http://de.archive.ubuntu.com/ubuntu xenial main restricted universe multiverse
deb http://de.archive.ubuntu.com/ubuntu xenial-updates main restricted universe multiverse
deb http://de.archive.ubuntu.com/ubuntu xenial-security main restricted universe multiverse
deb http://de.archive.ubuntu.com/ubuntu xenial-backports main restricted universe multiverse

step 2
after you can update your repo list and install openssh-server

apt-get  update
apt-get install  openssh-server

if you any problems with apt-get update than

rm -rf /var/lib/apt/lists/lock

and goto step 2 and run the commands again

Dont forget to stay over the droplet console while reinstall your ssh server.

Sorry you’re having trouble. Did you first run apt-get update before attempting to install openssh-server?

  • Yes. For a long time the SSH was working well, but it stopped working after we reset it.

    Why did we feel we needed to reset it?
    For some reason unknown to us, the password for one of our important usernames stopped working. Even when we changed the password using ‘root’ it continued to malfunction. Despite multiple password changes we were unable to access that account.

Submit an Answer