Categories
mac

Convert your Macbook with a Damaged Screen into a Home Server

Do you have a macbook that has a broken screen but still has everything else working okay.
You can convert it into a home server to store files and backups, a media server or a webserver.
Perhaps something else like a home ad-blocking DNS server

So how do you set it up?

  • The macbook needs the power cable in at all times
  • The macbook should be stored in a place where a bad actor cannot gain access to it (physcially)
  • The macbook should be connected to your wifi network – in an area with a decent signal strength

Getting Started

Accessing the server remotely

To access your server (macbook) remotely using SSH (Secure Shell) follow the apple guide.

  1. Go to System Preferences
  2. Click Sharing
  3. Allow Remote Login

Give it a Static IP Address

To make things easier assign a static ip on your local network to the macbook.

That way it won’t change dynamically after a power failure or if DHCP assigns it a new ip.

You can set the static ip in your home router configuration.

Securing the server on your Local Network

Now you don’t want anyone to just be able to ssh into your computer using the password they might already know.

We want to only allow our private key access to the server and prevent a password login.

Copy your ssh key to the server

ssh-copy-id user@macbook-ip

This copies your public key to the authorized keys file on your macbook server

To do that follow this prevent password remote login on macbook answer

sudo vim /etc/ssh/sshd_config

Set:

ChallengeResponseAuthentication no

Prevent the macbook from sleeping with Lid Closed

sudo pmset sleep 0
sudo pmset -b disablesleep 1

Source

Turn the Display and Keyboard lights Off

To stop wasting electricity and to deter nosy people from realising the machine is on…you can do this from the cli

pmset displaysleepnow

pmset lets you manipulate power management settings

The display and keyboard lighting can be turned back on by pressing the function keys as usual

For the keyboard apparently you could use defaults but I didn’t investigate much further – I just changed the function keys.

Remove processes and programs you don’t need

You don’t need to be running lots of things since the system is now being used as a server and not as a gui desktop.

What happens when you reboot or shutdown and restart the System

?