|
| su - centospub ← 登录为一般用户centospub ssh-keygen -t rsa ← 建立公钥与私钥 ← 钥匙的文件名,这里保持默认直接回车 ← 输入口令 ← 再次输入口令 |
| cd ~/.ssh ← 进入用户SSH配置文件的目录 ls -l ← 列出文件 id_rsa ← 确认私钥已被建立 id_rsa.pub ← 确认公钥已被建立 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys ← 公钥内容输出到相应文件中 rm -f ~/.ssh/id_rsa.pub ← 删除原来的公钥文件 chmod 400 ~/.ssh/authorized_keys ← 将新建立的公钥文件属性设置为400 |
| exit ← 退出一般用户的登录(返回root的登录) mount /mnt/floppy/ ← 加载软盘驱动器 mv /home/centospub/.ssh/id_rsa /mnt/floppy/ ← 将刚刚建立的私钥移动到软盘 umount /mnt/floppy/ ← 卸载软盘驱动器 |