2

I have two machines that were setup exactly the same with the same name and users and everything exactly the same. Each machine has two users with this names userA (userA@UserA) and userB (userB@UserA). I've connected both machines using a cable and setup a network wired connection and then ping and they both can see each other. This is how the etc/hosts look like in both machines:

127.0.0.1   localhost
127.0.1.1   UserA

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.0.1    master
192.168.0.2    slave

what I want to do is to change the UserA from both machines to make one named master and the other called slave so that on the master the users will be like this (userA@master and userB@master) while on the slave they will be (userA@slave and userB@slave).

The other thing I want to be able to do it is running this command:

userB@master:~$ ssh-copy-id -i $HOME/.ssh/id_rsa.pub userB@slave

but the problem when I run it I get this error:

/usr/bin/ssh-copy-id: ERROR: No identities found

So if anyone could please advise.

Pablo Bianchi
  • 17,371
Tak
  • 976
  • 3
  • 16
  • 35

1 Answers1

2

Question 1

How can I change the hostname?

To change the hostname of a Linux machine, use the hostname command. Also read the manpage, it has some more relevant information.

If you need to change the hostname as the other machine resolves it, change the /etc/hosts file, if you used that.

Question 2

I want to be able to do it is running this command: userB@master:~$ ssh-copy-id [...]

You have to generate ssh keys first, use ssh-keygen (manpage) for that. For e.g.:

ssh-keygen -t ed25519 -a 100
Pablo Bianchi
  • 17,371
Jan
  • 12,931
  • 3
  • 34
  • 39