Friday, April 13, 2007

Changing the default login shell on freebsd

Type chsh

Checking who's logged in linux/freebsd

Type who

Tuesday, April 10, 2007

Ubuntu: Automatgic login and starting up programs setup without gui

To set up auto login, edit this file:
$ sudo vi /etc/gdm/gdm.conf-custom


Make sure this line is present:
[daemon]
AutomaticLogin=djohnson
AutomaticLoginEnable=true


To autostart a program create files in this directory:
./config/autostart

Create files with the name xxxxx.desktop

e.g. to start x11vnc

Create a file called x11vnc.deskstop in ./config/autostart
[Desktop Entry]
Name=No name
Encoding=UTF-8
Version=1.0
Exec=x11vnc -shared -forever
X-GNOME-Autostart-enabled=t

How do to reverse port forwarding

Create this script in /usr/local/bin/reversessh.sh


#!/bin/sh

while [ 0 ]
do
dt=`date "+%Y/%m/%d %H:%M:%S"`
echo "$dt: ssh reverse forwarding restarted." >> /tmp/revssh.out
/usr/bin/ssh -N -R 10002:127.0.0.1:22 djohnson@146.64.24.58
sleep 15
done

Make sure it's executable
chmod +x /usr/local/bin/reversessh.sh

Add it to the startup scripts

Add following to /etc/init.d/reversessh

#!/bin/sh
/usr/local/bin/reversessh.sh &

Then make a link in the start up scripts init level 2

cd /etc/rc2.d
ln -s /etc/init.d/reversessh S92reversessh