自动创建.pem文件

时间:2019-06-25 12:09:44

标签: bash pem

我制作了一个bash脚本来自动创建.pem文件 我认为它可以帮助某些人。

#! /bin/bash
#Based on https://linuxaws.wordpress.com/2017/07/17/how-to-generate-pem-file-to-ssh-the-server-without-password-in-linux/
user=$(echo "$USER")
ssh-keygen << EOF
$user
EOF
mv $user $user.pem
sudo chmod    700   ~/.ssh
touch  ~/.ssh/authorized_keys
sudo chmod   600  ~/.ssh/authorized_keys
cat $user.pub >> ~/.ssh/authorized_keys
echo "Copy the $user.pem to your computer."

0 个答案:

没有答案