Link to home
Start Free TrialLog in
Avatar of ittechlab
ittechlabFlag for Canada

asked on

ssh - rsa

I was told to scp the following files from master server to all other 4 servers and remove the known_hosts file from ~/.ssh directory.

ssh_host_rsa_key.pub
ssh_host_rsa_key


is it ok to remove known_hosts file?

I did accedently removed the known_hosts file from all 4 servers as well. what is the impact?
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

The known_hosts file is important on the source machine (the one you come from) to make sure that the intended target host is reached and not a fake one.
It is not important on the target machine (the one you connect to)
Avatar of ittechlab

ASKER

i created a new user on a system and I don't see .ssh directory under the user's home directory.  do we have to create manually?
here is what i did

[user1@system4~]$ ssh-keygen -t rsa
[user1@system4 ~]$ cd .ssh
[user1@system4 .ssh]$ ls
id_rsa  id_rsa.pub

[user1@system4 .ssh]$ ssh-copy-id -i id_rsa.pub system4

.ssh/authorized_keys

to make sure we haven't added extra keys that you weren't expecting.

[user1@system4 .ssh]$ scp -p id_rsa* system1:`pwd`

scp: /home/user1/.ssh: No such file or directory
basically i created rsa keys and did ssh-copy-id to create authorized_keys on the same server.

I have three other systems and I have the same user on three systems. I am trying to copy the rsa.pub, private key and authorized_keys to other system so this user no need to login with the password in the future.
Depends. If you have enabled automatic or prompted acceptance of foreign host keys in ssh_config then the known_hosts file and the .ssh directory where it is in will be created by the ssh client.
During key pair creation the directory will be created as well.
Only if you want to create files there on your own (authorized_keys or environment, for example) then you must of course create the .ssh directory first.
its fresh install rhel 5.8 and no changes happened. when i ssh from system4 to system1 as a user1 wouldn't it create .ssh directory?
You're too fast!

Let's proceed step by step, and please don't panic! Don't post additional comments before I had my chance to answer!

OK?
1) Just ssh'ing somewhere does not create remote directories, thus it doesn't create .ssh, of course.

2) ssh-copy-id does create the remote .ssh directory, however (and the authorized_keys file therein).

3) Following your comment 39825454 you ran ssh-copy-id against system4 where .ssh already existed due to ssh-keygen, but then you tried to copy the rsa keys to system1! Who is supposed to have created .ssh on system1?
SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks.

However, when you try to connect to a server (hostname) for the first time, SSH will ask you  whether you accept new RSA key fingerprint. , you have to enter "yes".
To avoid entering "yes" for background applications what steps I should be doing? Please give me the detail step.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial