First Time Linux

This section deals with setting up a simple home network with a router and sharing files between the computers.

Setting up the router

In the simplest possible configuration, a cable modem plugs into the cable outlet, and the single computer plugs into the network socket of the modem. This was my configuration for a long time as I only had one computer and didn't want a wireless connection. This was because of simplicity (simple is good), security (controlling who is connected to the network), privacy (controlling who can see what I'm doing with the network), health (less EM radiation is good), speed (wired networks are always faster) and so on.

Anyway, the disadvantage with such a simple system is of course that only one computer can connect to the modem. As soon as the second computer arrived, it was going to have to get more complicated. I bought a simple 4-port wired router (from Netgear) and hooked that to the modem. Then the two computers simply plugged into the router. The router is configured to get an IP address dynamically via DHCP from the internet provider, and the two computers get their IP addresses also dynamically from the router.

Actually setting it up was pretty easy - the only trick was to update the firmware of the router (fortunately using a neat web front-end rather than a windows-only executable!) to allow it to connect more reliably to DHCP providers.

So now both computers have their own IP addresses and can connect independently to the internet. Super!

Sharing stuff

One thing it would be very useful to do is to now share files between the computers. Up until now I've relied on the good old-fashioned sneakernet (using a USB thumbdrive) but this is not terribly fast (especially as one of the machines only has USB1.1) and not good for large files (as I only have a 128 MB thumbdrive!). Another option is email, but this is also slow and even less suitable for large files.

The first new thing I tried was using Skype, because this is peer-to-peer (rather than via an email server) and so the transfer should now be able to go directly between the two computers and not have to go outside the router. So I ran Skype on both computers (one Mandriva, one windows), started a chat session between the two, and then initiated file transfers in both directions. They worked fine, but you can only send one file at a time, and it doesn't feel like an elegant solution.

What would be ideal, is if we can just share drives between the two computers, and copy/paste or drag/drop files backwards and forwards. So I intalled Samba on the Linux box, and ran through Mandriva's samba wizard to set up the sharing of a single directory under /var. This new directory belonged to root but had rwx rights given to everyone via chmod.

Having configured this, the windows machine still couldn't map a drive to it, because the linux firewall was preventing it. So I set the firewall to allow connections to SMB file sharing, and then the windows machine can read the drive on the linux box!

This allows sending of files from linux to windows, but not the other way round. For that we need write access too, and this was being prevented by Samba and its file permissions. Even though everybody has rwx permissions to the directory, and the windows machine was connecting as "nobody", it still couldn't write. Until I set the owner of the directory to "nobody" with chown -R nobody:root /var/sharedir and then the windows machine could copy files to this directory too.

Note that (as long as I understand it correctly) this directory isn't visible beyond the router, so nobody from outside could read or write to this directory. Which is good, because writing lots of data to this directory would fill up my root partition and potentially stop the machine from booting - it would be safer if the shared directory were in a separate partition.

And the other way

Out of interest, it would be nice to see if we can do the sharing the other way round - sharing a directory on the windows machine and reading/writing from the linux box. And in fact this was easier to accomplish - in windows a new directory was set to be "shareable" which brought up the network configuration wizard and allowed the activation of sharing. This required a reboot, but after this the folder was set to shared with read/write access.

Now from linux, I go to the url "remote:/" in Konqueror, and use the "Add a network folder" wizard to connect to the shared folder, using the IP address of the other machine. And hey presto, read/write access! Easy!