I have already setup the password-less login to localhost via ssh, and it works.

justinwu@ubuntu:~$ ssh root@localhost
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-110-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

2 packages can be updated.
0 updates are security updates.

New release '16.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Last login: Tue Mar  7 10:08:22 2017 from localhost

But while running one script and it needs to login as root via ssh, it returned the error 'Permission denied (publickey)'.

 Starting tests: Tue Mar  7 10:08:28 2017 

    Launching 20 processes.
    Starting test client: 0 Host:  localhost    Workload:      VDI  Workdir: /mnt/share
Permission denied (publickey).

It should work, but not sure why it's denied.

  • How did you set up the passwordless login? How does the debug log look like? – Jakuje Mar 7 '17 at 8:40
  • I use the command 'ssh-keygen' to generate the key and copy to the host 'ssh-copy-id root@localhost'. Then I check by using 'ssh root@localhost', it works. But the script way doesn't work. I cannot debug it because I don't have its source. Thanks! – JustinWuB Mar 7 '17 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.