I purchased the great Agile Web Development with Rails book and I am reading the Chapter 16: Deployment and Production. In that chapter there is a part (page 233) where it says how to set SSH keys:
test -e ~/.ssh/id_ssh.pub || ssh-keygen -t dsa
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorizedkeys2
but there is a very "minimal" text\description on how to "ssh'ing", so I did not understand some things. Where I should run the above commands: on the local or on the remote machine? And then, what I should to do to make it work?
P.S.: If I understood those keys serves me to not enter anymore password using the Capistrano gem. Is it th开发者_JS百科em purposes?
You generate a key pair on your own computer, and you copy the public key to the server. Then every time you log in to the server, instead of typing a password, you pass authentication using your private key.
You can read here about how to setup ssh authentication with keys:
How do I setup Public-Key Authentication?
Here is the paragraph that preceded those instructions:
The next thing to be aware of is that even if the SCM server and our web server are the same physical machine, Capistrano will be accessing our SCM software as if it were remote. We can make this smoother by generating a public key (if you don't already have one) and then using it to give ourselves permission to access our own server:
The intent here is that you execute those commands on the server so two different processes on the same machine (i.e. the SCM server and the web server) can communicate.
Disclosure: I am the author of that text, and appreciate the compliment. :-)
精彩评论