aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'overlay/sys-cluster/beowulf-head/files/setup-pwdless-ssh')
-rw-r--r--overlay/sys-cluster/beowulf-head/files/setup-pwdless-ssh31
1 files changed, 31 insertions, 0 deletions
diff --git a/overlay/sys-cluster/beowulf-head/files/setup-pwdless-ssh b/overlay/sys-cluster/beowulf-head/files/setup-pwdless-ssh
new file mode 100644
index 0000000..082a20f
--- /dev/null
+++ b/overlay/sys-cluster/beowulf-head/files/setup-pwdless-ssh
@@ -0,0 +1,31 @@
+#!/bin/bash
+pushd $PWD
+
+KEY_NAME="node_dsa"
+
+echo "Setting up passwordless ssh for $USER between master and the nodes"
+echo "The key is stored as $HOME/.ssh/$KEY_NAME(.pub)"
+
+mkdir -p $HOME/.ssh/
+cd $HOME/.ssh/
+
+ssh-keygen -t dsa -b 1024 -f $KEY_NAME -N ""
+# since this is an nfs-mounted $HOME, we simply add the key to self
+# Usually, this would have to be replicated to all remote hosts
+# if $HOME wasn't shared
+cat $KEY_NAME.pub >> $HOME/.ssh/authorized_keys
+
+chmod 600 $HOME/.ssh/*
+chmod 700 $HOME/.ssh
+
+cat >> $HOME/.ssh/config <<-EOF
+# Auto-generated by $0 to ease the use of passwordless logins for all users
+# Although this approach is questionnable, (Security on Host ...), it works
+Host *.gentoo.local node*
+IdentityFile $HOME/.ssh/$KEY_NAME
+StrictHostKeyChecking no
+CheckHostIP no
+Compression no
+EOF
+
+popd