12.07.2015 Views

download

download

download

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Network Services—Internet ServersIn case you have lost your private key, or the key is stolen, you shouldremove all public keys that you have installed on your hosts, and replaceit with your new public keys. Otherwise, the intruders can log into yoursystem using the private key.Losing your private key is just as if the intruder knows your password. Soyou should change your passwords (in this case, replacing or removingthe related public key) on all the hosts where you have used the password(or public key).Now that you have created your first set of keys, you should install the public key onthe hosts that you want to log into. This can be achieved by transferring the publickey to the destination host and adding it to the authorized_keys file.# scp .ssh/id_rsa.pub 192.168.0.5:.ssh/This will simply transfer the public key file to the destination host under the .sshdirectory. However, this time you will be authenticated using password. Once thepublic key is transferred, you should add the key to the list of authorized keys thatcan log in to the account. This would be as simple as logging into the remote hostand adding the file to the authorized_keys file under the .ssh directory.# cd .ssh# cat id_rsa.pub >> authorized_keysEvery time you start SSH for a secure shell connection, the SSH client looks for SSHprivate keys under the .ssh directory as well as the SSH key agent (This will bediscussed later in this chapter). If a key is found, the SSH client tries to authenticatethe session using the key. In case of success, you will log into the remote host.Otherwise SSH keeps trying other authentication methods, for example, a password.If your key is protected using a password, you will be asked the password, once thekey is loaded. If you are using SSH with keys frequently, it can be annoying to enterthe same password every time you run the SSH client. The ssh-agent(1) utility willhelp in solving this issue by loading the keys into the memory, for future use.SSH Authentication AgentIf you are a frequent SSH user (like every other system administrator), you willfind ssh-agent(1) very useful. The main goal of ssh-agent is to load one or moreprivate keys into the memory, so that the SSH client can use the keys from the agent.If the keys are password protected, you will be asked the password, once the key isloaded to the memory.[ 210 ]

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!