sh SSH KeyGen +复制Bash脚本(快速ssh密钥设置)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh SSH KeyGen +复制Bash脚本(快速ssh密钥设置)相关的知识,希望对你有一定的参考价值。

#!/bin/bash
#
# Creates an SSH key on a client machine, applies the appropriate file permissions,
# copies to the local ~/.ssh directory, & copies to specified server
#
# parameters:
# ..1 newKeyFileName
# ..2 user@server
#
# usage : 
# ./sshKeyGen.sh newKey user@server.com
#
ssh-keygen -t rsa -f $1
chmod 600 $1
chmod 600 $1.pub
mv $1 ~/.ssh/$1.pem
cp $1.pub ~/.ssh/$1
mv $1.pub  ~/.ssh/$1.pub
ssh-copy-id -i ~/.ssh/$1.pub $2

以上是关于sh SSH KeyGen +复制Bash脚本(快速ssh密钥设置)的主要内容,如果未能解决你的问题,请参考以下文章