This question already has an answer here:

I have created two LXC containers on my host Ubuntu 16.0.4 one is Ubuntu and the other is Centos7 .I am trying to copy file from Centos7 using scp command to Ubuntu as root user it is asking for root password while I entered correct password it’s showing permission denied.May I know the possible reason why I am getting denied?enter image description here

marked as duplicate by sebasth, dr01, Stephen Rauch, Philippos, Archemar Oct 4 '17 at 12:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Do you have SELinux running on the host? – Raman Sailopal Oct 4 '17 at 9:35
  • 1
    Can root usually SSH to that host? – Kusalananda Oct 4 '17 at 9:40
  • @Kusalananda no I can’t it’s also same getting permission denied – naveen8577 Oct 4 '17 at 9:47
  • @RamanSailopal SElinux is disabled in Centos7 – naveen8577 Oct 4 '17 at 9:47
  • How are you running the containers? nspawn? – Raman Sailopal Oct 4 '17 at 9:54

By allowing the root in /etc/ssh/sshd_config (PermitRootLogin Yes), I was able to login.

according to man sshd_config

         Specifies whether root can log in using ssh(1).  The argument must be “yes”, “prohibit-password”, “without-password”, “forced-commands-only”,
         or “no”.  The default is “prohibit-password”.

note that sshd must be restarted after a change in sshd_config.

Not the answer you're looking for? Browse other questions tagged or ask your own question.