
To generate a new SSH key, use the following command:
This command will prompt you for a location and filename to store the key pair and for a password. When prompted for the location and filename, just press enter to use the default. If you use a different name, the key will not be used automatically.
Use the command below to show your public key:
Copy-paste the key to the 'My SSH Keys' section under the 'SSH' tab in your user profile. Please copy the complete key starting with ssh-rsa and ending with your username and host.
To copy your public key to the clipboard, use the code below. Depending on your OS you'll need to use a different command:
2、查看host
查看本地ssh 的方法
终端输入:
就能看到你的私人秘钥了
参考文章 https://confluence.atlassian.com/bamkb/ssl-certificate-subject-305037865.html
1、创建私有CA并进行证书申请。
2、总结ssh常用参数、用法
SSH(全称 Secure Shell)是一种加密的网络协议。使用该协议的数据将被加密,如果在传输中间数据泄漏,也可以确保没有人能读取出有用信息。要使用 SSH,目标机器应该安装 SSH 服务端应用程序,因为 SSH 是基于客户-服务模式的。 当你想安全的远程连接到主机,可中间的网络(比如因特网)并不安全,通常这种情况下就会使用 SSH。默认的centos7中自带sshd服务。
客户端ssh命令
格式:
常见选项:
scp命令
用于服务之间文件的互传
选项
rsync 命令
rsync工具可以基于ssh和rsync协议实现高效率的远程系统之间复制文件,使用安全的shell连接做为传
输方式,比scp更快,基于增量数据同步,即只复制两方不同的文件,此工具来自于rsync包
3、总结sshd服务常用参数。
sshd(secure shell)服务使用ssh协议远程开启其他主机shell的服务。首先需要打开sshd 服务
sshd服务状态调整
查看配置文件
一、准备两台服务器:
A机:192.168.1.1
B机:192.168.1.2
二、双机建立信任
1、在A机生成秘钥证书
在root下执行ssh-keygen命令,一路回车,生成秘钥证书
# ssh-keygen -t rsa
2、查看生成秘钥文件
# cd ~/.ssh
# ll
文件:私钥证书id_rsa、公钥证书id_rsa.pub
3、A对B建立信任关系
3.1 将公钥证书id_rsa.pub复制到机器B的root家目录的.ssh子目录中,同时将文件名更换为authorized_keys
# scp -r id_rsa.pub root@192.168.1.2:/root/.ssh/authorized_keys
3.2 若3.1报错:No such file or directory
使用:# ssh-copy-id -i id_rsa.pub root@192.168.1.2
ssh-copy-id命令会自动将id_rsa.pub文件的内容追加到远程主机root用户下.ssh/authorized_keys文件中
3.3 查看B机器是否接收
# ssh 192.168.1.2
# cd .ssh/
# ls
# cat authorized_keys
# exit
3.4 B对A建立信任,同上3的 *** 作步骤
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)