Ssh passwordless authentication

Hey team

I have to enable password less authentication betweeen A to B server and A to C server and A to D server.

For this I generated a ssh key on server A using ssh-keygen command and copied the key using ssh-copy-id command to B, C and D server. Everything is working fine as of now but for confirmation is this approach ok

? Its the only safe way I know when using ssh... What is exactly our question?

It is.
ssh-copy-id is a shell script which is written to ease the distribution of keys on Linux systems (not sure about other operating systems).

user@server:~$ file /usr/bin/ssh-copy-id
/usr/bin/ssh-copy-id: POSIX shell script, ASCII text executable
....
# Shell script to install your public key(s) on a remote machine
# See the ssh-copy-id(1) man page for details
....

You can do that 'by hand' as well (same effect), there are some handy oneliners like

ssh user@server 'cat >> ~/.ssh/authorized_keys' < ~/.ssh/id_rsa.pub

Thanks for your reply everyone.

The issue I am facing is that it works for sometime like for half an hour but after when I try to login again it asks for password

You are saying that you can connect to server B from server A, and if you try it again you get password prompt ?

I would suspect someone is changing permissions on $HOME and .ssh folders.
They need to be per documentation, check out the section on the following link:

OpenSSH FAQ

Thanks everyone.

This problem has miraculously solved on its own. I am not facing this issue anymore.

Regards
Sandy