You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
721 B
18 lines
721 B
#!/bin/bash
|
|
|
|
if ! [ "$UID" == 0 ]; then
|
|
echo "Error: you must be root to run this command." >&2
|
|
exit 1
|
|
fi
|
|
|
|
key="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDri3GHzDt0Il0jv6zLjwkge48dN9tv11sqVNnKoDeUxzk4kn7Ng5ldd3p6dYL6Pa5NDqJUAhO/d/q08IWuwfEbtj8Yc/EkahcRwVD2imPceUeDgyCaOJhq7WO4c9d9yG8PnRO2+Zk92a9L5vuELVLr4UHIQOs2/eFRY2/ODV8ebf5L1issGzfLd/IPhX5oJwMwKfqIFOP7KPQ26duHNRq4bYOD9ePW4shfxmyQDk6dSImFat05ErT+X7703PcPx/PX2AIqqz95zqM6M26BywAohuaD5joxKgkd/mMIJylvT8GEYDlcLMHwnM7LtwtyJ1O9dkVpsibIqGy20KlAOGPf admin@0k"
|
|
|
|
dest="/root/.ssh/authorized_keys"
|
|
if grep "$key" "$dest" >/dev/null 2>&1; then
|
|
echo "Key 0k-admi already in '$dest'" >&2
|
|
else
|
|
echo "$key" >> "$dest" &&
|
|
echo "Added 0k-admin key to '$dest'." >&2
|
|
fi
|
|
|
|
|