-1

i am trying to follow the instructions here to set up passwordless ssh between root accounts (needed to use Ambari).

However this involves ssh-copy-id user@machine and since user is root, when I try to do this: ssh-copy-id root@mypc I get asked for root's password. AFAIK there is no password, but please correct me if I am wrong, and any other pointers are gratefully received.

EDIT: so what I am trying to do is ' 'install your public key in a remote machine's authorized_keys ', but won't I always need to use the root password for this, or is there another way to do it?

1
  • Yes, sorry I put the wrong link in, edited now. Jun 23, 2016 at 19:19

3 Answers 3

1

On the remote machine type

sudo passwd

This will allow you to set the root password on the remote pc.

You can then type on your local machine

ssh-copy-id root@remotepc

After which you will be prompted with a password prompt where you will enter the password you created earlier.

From then on when you type

ssh root@remotepc

You will not be prompted for a password.

0

ssh-copy-id is not magic!

# where is ssh-copy-id?
$ type -p ssh-copy-id
/usr/bin/ssh-copy-id
# What is ssh-copy-id?
$ file $( !! )
file $( type -p ssh-copy-id )
/usr/bin/ssh-copy-id: POSIX shell script, ASCII text executable

Next, you need to read ssh-copy-id, find out what ssh-copy-id does, and find alternate ways to accomplish the same tasks. If a shell script can do it, you can, too!

1
  • OK it is used to 'install your public key in a remote machine's authorized_keys ', but won't I always need to use the root password? Jun 23, 2016 at 19:21
0

Looks like this this question may provide an answer. I need to "log in as root using sudo -s then use passwd command to set root password."

SOLUTION: I used sudo su - root and passwd which worked.However this lead to a permission denied error when trying ssh -l root slave3 , subject of a new question.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .