码迷,mamicode.com
首页 > 其他好文 > 详细

Working with SSH keys

时间:2016-01-06 13:46:46      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:

SSH keys are a way to identify trusted computers, without involving passwords. Most git servers choose SSH keys to authorize clients.

Check for SSH keys

check for existing SSH keys on your computer.

$ ls -al ~/.ssh
# Lists the files in your .ssh directory, if they exist
Check the directory listing to see if you already have a public SSH key. By default, the filenames of the public keys are one of the following:
  • id_rsa.pub
  • id_dsa.pub

Generate a new SSH key

1) Creates a new ssh key, using the provided email as a label
$ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
2) We strongly suggest keeping the default settings as they are, so when you‘re prompted to "Enter a file in which to save the key", just press Enter to continue.
Enter file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]
3) We strongly recommend a very good, secure passphrase.
Enter passphrase (empty for no passphrase): [Type a passphrase]
Enter same passphrase again: [Type passphrase again]
4) After you enter a passphrase, review the fingerprint, or id, of your SSH key.

Add the New SSH Key to Server

Add the content of id_dsa.pub to the end of  sever’s authorized_keys

echo ‘the content of id_dsa.pub’ >> ~/.ssh/authorized_keys

Configure SSH Client

Edit ssh configuration file ‘~/.ssh/config’.

Host servername
HostName 192.168.3.1
User Admin
IdentityFile ~/.ssh/id_rsa
CompressionLevel 6

Now you can test the ssh connection

ssh servername

Working with SSH keys

标签:

原文地址:http://www.cnblogs.com/luckysimple/p/5105089.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!