Working with SSH keys

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 "[email protected]"
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

时间: 2024-11-02 18:34:51

Working with SSH keys的相关文章

Generating SSH keys

Generating SSH keys MAC WINDOWS LINUX ALL SSH keys are a way to identify trusted computers, without involving passwords. The steps below will walk you through generating an SSH key and adding the public key to your GitHub account. We recommend that y

SSH keys Generate

An SSH key allows you to establish a secure connection between your computer and GitLab. Before generating an SSH key, check if your system already has one by running cat ~/.ssh/id_rsa.pub. If you see a long string starting with ssh-rsa or ssh-dsa, y

git ssh keys生成步骤

1.在github上面注册... 2.生成ssh密钥生成过程 1).查看是否已经有了ssh密钥: cd ~/.ssh 2).生成密钥 $ ssh-keygen -t rsa -C "[email protected]"  (注册github的邮箱账号) 回到github,进入Account Settings,左边选择SSH Keys,Add SSH Key,title随便填,粘贴key.为了验证是否成功,在git bash下输入: $ ssh -T [email protected]

为github帐号添加SSH keys(Linux和Windows)

文章转自:https://blog.cofface.com/archives/406.html/2 一.Linux增加ssh keys方法: 使用git clone命令从github上同步github上的代码库时,如果使用SSH链接(如我自己的cofface_recovery项目:[email protected]:cofface/cofface_recovery.git),而你的SSH key没有添加到github帐号设置中,系统会报下面的错误:Permission denied (publi

Git 进阶指南(git ssh keys / reset / rebase / alias / submodule )

在掌握了基础的 Git 使用 之后,可能会遇到一些常见的问题.以下是猫哥筛选总结的部分常见问题,分享给各位朋友,掌握了这些问题的中的要点之后,git 进阶也就完成了,它包含以下部分: 如何修改 origin 仓库信息 如何配置 git ssh keys 如何撤销修改 遇到冲突了怎么解决 git stash / alias / submodule 的使用问题等 问:如何修改 origin 仓库信息? 1.添加 origin 仓库信息 git remote add origin <git仓库地址>

mac下生成ssh keys 并上传github仓储

使用github仓储需要本机生成一个公钥key 添加到自己的git账户SSH keys中 mac 生成方法: 1. 打开终端 输入 ssh-keygen 然后系统提示输入文件保存位置等信息,连续敲三次回车即可,生成的SSH key文件保存在中-/.ssh/id_rsa.pub 2. 然后用文本编辑工具打开该文件,我用的是vim,所以命令是: vim ~/.ssh/id_rsa.pub 将内容拷贝到github里起个名字就可以了. 注意:拷贝.pub中的内容时候需要将"ssh-rsa"这

Generating SSH Keys [Ubuntu Linux]

Generating SSH Keys We strongly recommend using an SSH connection when interacting with GitHub. SSH keys are a way to identify trusted computers, without involving passwords. The steps below will walk you through generating an SSH key and then adding

Ubuntu下升级Git以及获取ssh keys的代码

今天开始用的git,记下获取ssh keys 的代码 ? 1 2 3 ssh-keygen -t rsa -C "[email protected]" # Enter file in which to save the key (/home/you/.ssh/id_rsa): ssh-add id_rsa http://my.oschina.net/silentboy/blog/195741?p=1 这里建议直接回车,就在当前目录下创建id_rsa.pub,不然会像我一样,路径搞错,v

win10生成SSH keys

win10生成 SSH keys: SSH key 可以让你在你的电脑和Code服务器之间建立安全的加密连接. 先执行以下语句来判断是否已经存在本地公钥: cat ~/.ssh/id_rsa.pub 如果你看到一长串以 ssh-rsa或 ssh-dsa开头的字符串, 你可以跳过 ssh-keygen的步骤. 提示: 最好的情况是一个密码对应一个ssh key,但是那不是必须的.你完全可以跳过创建密码这个步骤.请记住设置的密码并不能被修改或获取. 你可以按如下命令来生成ssh key: ssh-k