Jonathan Golder
6 years ago
commit
578fa5c092
1 changed files with 47 additions and 0 deletions
@ -0,0 +1,47 @@ |
|||||
|
#!/bin/bash |
||||
|
# |
||||
|
# sysinit.sh |
||||
|
# |
||||
|
# Prepares new (virtual) hosts for ssh/ansible/spice usage |
||||
|
# |
||||
|
# Copyright 2018 Jonathan Golder <jonathan@golderweb.de> |
||||
|
# |
||||
|
# This program is free software; you can redistribute it and/or modify |
||||
|
# it under the terms of the GNU General Public License as published by |
||||
|
# the Free Software Foundation; either version 2 of the License, or |
||||
|
# (at your option) any later version. |
||||
|
# |
||||
|
# This program is distributed in the hope that it will be useful, |
||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
|
# GNU General Public License for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU General Public License |
||||
|
# along with this program; if not, write to the Free Software |
||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
||||
|
# MA 02110-1301, USA. |
||||
|
# |
||||
|
# |
||||
|
|
||||
|
# Config |
||||
|
KEY="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAICX11TndEey9n1apGleTLfXan8j0K50Y92/BCYmtOpGC hallo@golderweb.de" |
||||
|
AUTHKEYFILE="${HOME}/.ssh/authorized_keys" |
||||
|
|
||||
|
# Install ssh-server |
||||
|
sudo apt-get update |
||||
|
sudo apt-get install openssh-server |
||||
|
|
||||
|
# Configure public key |
||||
|
# Make sure user's ssh config dir exist |
||||
|
if [[ ! -d "${HOME}/.ssh" ]]; then |
||||
|
mkdir "${HOME}/.ssh" |
||||
|
fi |
||||
|
|
||||
|
# Add key to authorized_keys file if not present |
||||
|
if [[ ! -f "$AUTHKEYFILE" ]] || ! grep -q "$KEY" "$AUTHKEYFILE"; then |
||||
|
echo "$KEY" >> "$AUTHKEYFILE" |
||||
|
fi |
||||
|
|
||||
|
# Install spice-vdagent |
||||
|
sudo apt-get install spice-vdagent |
||||
|
|
Loading…
Reference in new issue