Quote:
Originally Posted by
vikas.rao11
Thank dude.One more question though.
This keeps prompting for a password..
The reason is you haven't "exchanged the keys" as manikantants has "believed". ssh is a system where you can designate machine/user combinations as "trusted", so that they won't need a password. Do the following:
i assume you use user a on machine a to connect to machine b as user b. You don't want to need passwords if user a@a connects to b@b.
1.) log on to machine a as user a. Enter "ssh-keygen" to generate a key and follow the instruction. Do NOT enter any password when you are asked for it. Just press <ENTER>.
2.) You now have a directory "~/.ssh" with some files in it, depending on what type of key you have selected with ssh-keygen. In case you selected "rsa" in step one there would be two files "id_rsa" and "id_rsa.pub". NEVER TOUCH THE FILE id_rsa! Open the file id_rsa.pub with some editor or "cat" it to the terminal.
3.) Log on to machine b as user b and - if there is no directory "~/.ssh" - create a key there (Step 1). You won't need the key, but it creates the directory structure (~/.ssh) with the correct permissions as well.
4.) If there is no file "authorized_keys" create it, otherwise open it with a text editor. Cut and paste the content of of the file id_rsa.pub from the other machine to the end of this file. CAUTION: this is ONE long line, if you use screen-cut-and-paste you might get several lines of text delimited by newlines. Remove the newlines to get one long line back in this case. Save the file.
5.) From now on you can log on or transfer files without giving any password as user a@a to user b@b, but not the other way round. If you log on as user b@b you will have to present a password if you want to execute commands as user a@a. If you want to remove the necessity for passwords there too you will have to do the described process in the other direction again. CAUTION: you have to create a key (Step 1) ONLY ONCE, creating a new key makes all the entries in other authorized_key-files invalid.
I hope this helps.
bakunin