File: ssh-keys

package info (click to toggle)
ganeti-instance-debootstrap 0.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 240 kB
  • sloc: sh: 488; makefile: 54
file content (18 lines) | stat: -rwxr-xr-x 413 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
  echo "Missing target directory"
  exit 1
fi

# user to give access to. can be hardcoded or fetched from some other place
: ${USER:="myuser"}
# keytype: rsa or dsa
: ${KEYTYPE:="rsa"}

if [ -f /home/$USER/.ssh/id_$KEYTYPE.pub ]; then
  install -D -m 0700 -o root -g root \
    /home/$USER/.ssh/id_$KEYTYPE.pub $TARGET/root/.ssh/authorized_keys
fi

exit 0