summaryrefslogtreecommitdiffstats
path: root/vagrant/autocluster_ssh_node_setup.sh
blob: aeea98a9c1797c2f208dd620865c75a5a00b49ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

set -e

user="vagrant"
key="id_autocluster"

u_ssh="/home/${user}/.ssh"
r_ssh="/root/.ssh"

mkdir -p "$r_ssh"
chmod 700 "$r_ssh"
cp "${u_ssh}/${key}" "${r_ssh}/"
cp "${u_ssh}/${key}.pub" "${r_ssh}/"
cat "${u_ssh}/${key}.pub" >> "${r_ssh}/authorized_keys"
if selinuxenabled >/dev/null 2>&1 ; then
	#chcon -t ssh_home_t "${r_ssh}/authorized_keys"
	restorecon -R "$r_ssh"
fi
cat "${u_ssh}/${key}.pub" >> "${u_ssh}/authorized_keys"
if selinuxenabled >/dev/null 2>&1 ; then
	#chcon -t ssh_home_t "${u_ssh}/authorized_keys"
	restorecon -R "$u_ssh"
fi