$ cd ~/.ssh
$ ssh-keygen -t rsa
------------------(如果非git配置,请忽略)-------------------------
⚠️⚠️⚠️⚠️
- 如果在git中需要配置邮箱的话使用如下命令
$ ssh-keygen -t rsa -C "xxxx@58.com"
⚠️⚠️⚠️⚠️
- 查看邮箱配置(git config --list)
user.name=lizhiqiang17
user.email=lizhiqiang17@58.com
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
78:13:76:05:4e:76:f6:b9:55:e4:4b:85:bc:fe:48:e0 root@zhaopin-2-25.zpidc.com
The key's randomart image is:
+--[ RSA 2048]----+
| +.+. o+|
| + + .ooo|
| o o ooo|
| o o . oo.|
| . S . o.. |
| . . E o |
| . o |
| . .|
| |
+-----------------+
扩展
- 命令登陆服务器
ssh '用户名'@'ip' -p '端口' -i '私匙路径'
例:ssh lizhiqiang@172.16.101.222 -p 10022 -i /Users/lizhiqiang/.ssh/id_rsa
- 查看当前路径
pwd
- 拷贝当前文件到指定路径
sudo cp -r '当前路径文件名' '指定路径'
例:sudo cp -r test /export/home/wjkjapp
- 删除文件
sudo rm -rf '路径'
例:sudo rm -rf /export/home/wjkjapp/test
查看已有SSH
截屏2022-01-19 下午9.44.34.png