Getting my pi on the network

I have recently been setting up a Raspberry Pi and documenting the process here.

In previous posts I have been dealing with the RISC OS setup. Today I moved over to Raspbian. This post will deal with:

  • Getting the Pi to see my home network hard drive.
  • Setting up the Pi as a home server.
  • Changing the system password.

Getting the Pi to see the network hard drive
I have a 2TB USB hard drive on my home network. I use this to share music, movies and other media between computers in my home. You can read my full article about getting a USB hard drive to work on your network, however I have summarised the steps for Raspbian below.


  • You need to mount the network drive into the Raspbian file system.  To do this you need to have cifs-utils installed.  My Raspberry Pi 2 came with this pre-installed.  You can check whether it exists or not by running the following command: dpkg -s cifs-util


  • Should you need it, you can install cifs using the command sudo apt-get install cifs-utils


  • Next create a directory on your pi for where you want to mount the network drive: sudo mkdir -p /media/network/public


  • You need to edit the etc/fstab file in order to mount the network drive. You may need to give yourself permission to do this, so navigate to your /etc folder and type chown pi: fstab (where pi is your username).


  • Now open the etc/fstab file in your text editor and add the following single line:

   //192.168.1.254/usb1 /media/network/public cifs defaults,rw,username=pi,password=yourpassword,domain=domain 0 0

Note that the first part is //IP ADDRESS OF ROUTER/directory name of network folder. If your network folder has any spaces in the name, eg "My Documents", then replace the spaces with \040, eg My\040Documents.

The second part is the path to the folder you created in part 3. You will need to put in your own username and password .


  • Now mount the drive using sudo mount -a


Once complete, you will see your network drive appear as a folder in your file manager.

Raspberry Pi file manager showing network drive

Setting up the Pi as a home server
The following steps will allow your Raspberry Pi to serve dynamic web pages to other devices on your network.

  • First install the full LAMP stack with sudo apt-get update and then sudo apt-get install apache2 php5 php5-mysql mysql-server
  • This will install all the software that you will need to run a home server. You may be prompted to enter a password so do add a suitably secure password at this stage. Once you are happy with your password (at it is one that you will remember) the rest of the process may take a few minutes.
  • When the install finished you should navigate to the /var/www/html folder. This folder will contain all of the files that your server will use.
  • To check that your server is working, Apache should provide a test page. Using another computer or phone type the IP address of your web server on your home network. Mine is http://192.168.1.162 and you may be able to get this information from your home router page or using the command ifconfig. If all is well, you should get a confirmation page.
Apache confirmation page as viewed in Chrome browser under Windows 10

  • You can now replace this file with your own home page. Should you find that you do not have permission to access files in your webserver, you can use the Linux chown command to change ownership permissions. The syntax is: sudo chown pi: item where pi is your username and item is the name of the file or folder you wish to access, for example: sudo chown pi: index.html will give you ownership access to the file. It may still mean that you can't edit the file, so navigate to the file in your file manager, right click and bring up the 'properties'. Then change the 'permissions' to 'change content: anyone'.
Changing the system password
Now that your Raspberry Pi system is running a web server and has access to the network drive, you will probably want to set the password for access to the Raspberry Pi system. Your Pi may boot directly into a password entry when it boots, however many new installations of Raspbian skip this step so as to make using the machine as painless as possible for new users.

  • Find the main menu, and navigate to 'Preferences' and then 'Raspberry Pi Configuration'.

Finding the password preferences in Raspbian
  • You will be prompted to enter your old password before you can change it. If you are using the default user 'pi', then the default password is 'raspberry'.
  • Make sure that you un-check the box that says Login as user 'pi'.
Hit the 'change Password...' button to change your password. Then make sure you un-tick the box shown. This is what has been letting you log in automatically to the Raspberry Pi, but it also lets your little brother get in and see all your stuff too!


Well, that's all I have for today.  If you are still awake, then you might be interested in some more Raspberry Pi related posts.