Quote:
Originally Posted by
abhi_123
Is it possible that public key of system-B can be shared to system-A, so that the system-A can establish connectivity to system-B via scp/sftp or using jdbc(java).? Is this even possible?
Yes, it is possible and yes, such a public key is valid for scp-, sftp- and ssh-connections. I don't know if jdbc can use the same key, however.
scp, ssh and sftp all share the same protocol (SSL, secure socket layer) and the keys you exchange are the keys for the protocol, not the application on top of it, therefore the keys are valid for all (or none) of them.
A "key" is exactly what it name suggests: on a system (let us call it "server") in the home of a specific user (call it "serveruser") we put a key of the user "clientuser" from "client". From now on an incoming connection from "clientuser@client" to "serveruser@server" is authenticated via the key instead of a password.
Two things to keep in mind: first, authentication is a
directed thing: if "clientuser@client" is allowed access as "serveruser@server" that does NOT mean "serveruser@server" is allowed access as "clientuser@client". It is possible to set that up but these are two different keys placed in two different places where "source" and "target" are reversed. Each of these keys allow for a one-way authentication. (If i give you the keys to my house it does not mean i could enter yours too - you would also have to give me your keys for that.)
Second: all these protocols work in a client-server model. That means for i.e. the ssh connection to work the ssh-daemon has to run on the server side. What the "server" and what the "client" is is determined by the sort of connection, not the system! Trying to log on from system A to system B means A is client, B is server. Trying to log on from B to A reverses these roles, so in the first connection B has to have the daemon running, in the second one it has to be A.
I hope this helps.
bakunin