-1

Apologies if this question isn't sophisticated enough, I am sort of new to Gnu/Linux. I've 4 VMs in Azure all running CentOS, 1 master and 3 workers.

I've set up a passwordless authentication between these using ssh-keygen and ssh-copy-id commands and added hostnames with respective IP addresses into the /etc/hosts file. Everything works OK. However if I log into the master not from my work laptop, but from my home machine (using putty), with the same user I cannot do ssh worker1 anymore, I get permission denied (public_key) and I don't understand why it is, as this was set between the hosts, why does it matter where I'm logging in from. Can anyone explain please?

  • Can you run the @ form on both?: ssh -vvv user@machine, and run ssh-add -l on both machines. Edit question to show the output of both commands. Have you added the public key of your home machine to the servers? – ctrl-alt-delor Jul 10 at 17:51
  • It the master called worker1? – ctrl-alt-delor Jul 10 at 17:52
  • There is a master and worker1, worker2 and worker3. So i can log into the master from my home machine using the username and password, but i cannot do ssh worker1 or ssh worker2 anymore, it works if i log in from the same machine which i've used to set up the authentication from but not from another machine. In principle is it a normal behavior? Is there some MAC address stamp or anything like that...? – user361738 Jul 10 at 18:05
  • Oh that is not what you said in the question. Can you update the question. – ctrl-alt-delor Jul 10 at 18:10
  • There is a master and worker1, worker2 and worker3. No i haven't added public key of my home machine, but i've added a public key of an 'admin' user on master to all 3 workers so i expect it should work no matter which host i login from. I can log into the master from my home machine using the username and password, but i cannot do ssh worker1 or ssh worker2 anymore, it works if i log in from the same machine which i've used to set up the authentication from but not from another machine. In principle is it a normal behavior? Is there some MAC address stamp or anything like that...? – user361738 Jul 10 at 18:12
0

You probably uploaded a wrong public key to the worker machines. Check the ~/.ssh/authorized_keys file on workers and make sure it matches the public key (probably ~/.ssh/id_rsa.pub) on the master node.

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.