Monday, November 17, 2008

HOWTO prepare your mac-mini to headless mode

First you have to enable your ssh-deamon on your mac. Go to system properties and enable remote connection.

Before, you should change your standard ssh-port 22 to another port for security reasons.
Change port 22 to whatever you want in /etc/sshd_config and save (need administrator privileges).

If you are behind a router, you should forward this port to you local ip (get with ifconfig -a).

If your router supports dynamic dns, you can access your mac-mini from any place of the world, you only need a terminal or PuTTy (on Windows). Besides, you should create an account on dyndns.com to use dynamic dns.

Open terminal and create a screen with title you want:
screen -S mac-mini
Inside screen, you can now do what you want, e.g. start top

Now you can connect remote with:
> ssh -p port user@host
e.g ssh -p 1234 dba@golgarin.podzone.org

Attach to screen with ctrl +a +x.

Voila, you should now see the top you started before.

screen is very useful, here is a short keymap:
screen (starts a screen session) 
ctrl +a +x (reattach to an existing screen session)
ctrl +a +d (detach from screen session)

ctrl +a +c (create a new screen)
ctrl +a +n (step to next screen)
ctrl +a +p (step to previous screen)
ctrl +a +? (screen help for further details)


Now you can do a lot of cool stuff inside the screen, e.g. running a torrent client, managing
your audio recordings remotely and so on.

No comments: