-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathgenerate_ssh_key.sh
More file actions
executable file
·43 lines (35 loc) · 925 Bytes
/
generate_ssh_key.sh
File metadata and controls
executable file
·43 lines (35 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
################################################################################
# Date: 2011/06/16
# Author: appleboy ( appleboy.tw AT gmail.com)
# Web: http://blog.wu-boy.com
#
# Program:
# Generating SSH Keys
#
# History:
# 2011/06/16 (first release)
# 2012/10/09 (check id_rsa and id_rsa.pub exist)
#
################################################################################
VERSION="0.1"
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin
export PATH
function displayErr()
{
echo $1;
exit 1;
}
function usage()
{
echo 'Usage: '$0' Your_email'
exit 1;
}
if [ "$#" -lt "1" ]; then
usage $0
fi
test -e ~/.ssh/id_rsa && displayErr "Please remove or backup ~/.ssh/id_rsa file first"
test -e ~/.ssh/id_rsa.pub && displayErr "Please remove or backup ~/.ssh/id_rsa.pub file first"
mkdir -p ~/.ssh
ssh-keygen -t rsa -C $1
displayErr "Generating SSH Keys Completely"