Wednesday 13 May 2009

Script for getnet

Run this on the computer for automatic access to the interboob

#!/bin/bash

USER=`id -nu`

ssh smokey@192.168.0.1 sudo usermod -s /bin/bash internet
ssh-keygen -t rsa -f keyfile
sudo cp keyfile* /etc/ssh/
ssh-copy-id -i /etc/ssh/keyfile.pub internet@192.168.0.1

if [ -f /root/.ssh/known_hosts ]
then
cat ~/.ssh/known_hosts | sudo tee -a /root/.ssh/known_hosts
else
sudo mkdir /root/.ssh
sudo cp ~/.ssh/known_hosts /root/.ssh/known_hosts
fi

echo '#!/bin/bash
if iwconfig | grep -c interboob
then
nohup ssh -i /etc/ssh/keyfile -N -D 8080 internet@192.168.0.1 > /dev/null 2>&1 &
fi' | sudo tee /etc/network/if-up.d/dogetnet

sudo chmod +x /etc/network/if-up.d/dogetnet

ssh smokey@192.168.0.1 sudo usermod -s /usr/sbin/nologin internet



No comments:

Post a Comment