Skip to content
Browse files

Added scripts folder and the setup-autologin script for setting up au…

…tomatic logging in to the Naos.
  • Loading branch information...
1 parent e5c1115 commit 76578e48d3c8ce6c416dabda58d8351c69b2332f @chachi chachi committed Dec 17, 2009
Showing with 39 additions and 0 deletions.
  1. +39 −0 scripts/setup-autologin
View
39 scripts/setup-autologin
@@ -0,0 +1,39 @@
+#!/bin/sh
+###############################################################################
+# This script will setup auto-login into a remote machine. Specifically,
+# this is is useful for seting up auto-login for the Naos.
+# Instructions filtched from http://linuxproblem.org/art_9.html
+#
+# NOTE: If you run this script twice on the same robot, your hostname will
+# appear twice in .ssh/authorized_keys. Login will still work, but you will
+# bloat the file
+#
+# jstrom, June 2008
+#
+##############################################################################
+
+REMOTE_USERNAME=root
+SSH=~/.ssh
+ID_RSA_FILE=$SSH/id_rsa
+RSA_PUBLIC_KEY_FILE=$SSH/id_rsa.pub
+
+if [ "$1" == "" ]; then
+ echo "Usage: ./setup-autologin <robot-ip>"
+ exit 1
+fi
+
+echo "Configuring auto login. Only run this once per robot "
+
+
+if [ ! -e $RSA_PUBLIC_KEY_FILE ] || [ ! -e $ID_RSA_FILE ]; then
+ echo "Generating a public key"
+ ssh-keygen -t rsa -N "" -f $ID_RSA_FILE
+else
+ echo "Detected an exisiting public key, so won't generate a new one"
+fi
+
+echo "Configuring remote robot with your public key."
+echo "Please enter the password for the robot when promted:"
+cat $RSA_PUBLIC_KEY_FILE | ssh $REMOTE_USERNAME@$1 'mkdir -p .ssh && cat >> .ssh/authorized_keys'
+
+echo "setup complete"

0 comments on commit 76578e4

Please sign in to comment.
Something went wrong with that request. Please try again.