1. Computing

Some Tips for Using a Raspberry Pi

Remote accessing, working as root and SD Cards

By

These are notes built up from my experience of using Linux PCs on a network, and from trying things out with my Raspberry Pi. Although you can do everything on the Raspi you may find it easier to do so from a networked Windows or Linux PC (or a Mac). If your PC isn't networked and it has an Ethernet connector (most do), buy an Ethernet 4 way switch for about $30 and two ethernet cables.

Display

If you have a HDMI compatible monitor or TV that you can use with it then no problems. However the older more plentiful monitors with DVI interfaces will also work. You just have to buy a HDMI to DVI cable. Amazon sell them, and I bought and use this one which cost me £2.19.

Remote Access

In my article on programming the PI in C, I suggested you install Samba so you can access your Raspi from a networked Windows PC through a mapped drive.

However there are other ways. The Raspi can run a SSH server which means you can securely remote in. Here is how to install SSH on your Raspberry Pi™.

Once SSH is up and running you can run Putty to log in. You'll find the link in the C Code library and you can run putty from Linux or Windows networked pcs.

If you are networking from a Windows PC, you may prefer to install and run WinSCP which is linked to in the C++ Code library. This gives you a graphical view of the Raspi's folders. Note the view is limited to that available to the user you log in as.

SD Cards

SD = Secure Digital and it's not just one family but several families so SDHC is Secure Digital High Capacity and goes up to 32GB capacity. Beyond that you need SDXC which goes up to 2TB. I'm not sure there are many of those about! For most people 4GB, 8GB or 16GB is enough but there are a couple of gotchas:

Gotcha 1. Card Speed.

These come in various classes with class 2 the slowest and Class 10 the fastest unless you want to pay more for the UHS SD cards which are much faster but a lot more expensive. At the time of writing Class 10 16GB SDHC cards are around $16. I've not seen any performance figures but the faster write speed should speed up upgrades, installs, compiles etc.

Gotcha 2. Card Capacity.

Your Raspi only gives you a slice of disk not the whole thing becaus ethe disk image is based on a 2GB partition. If you have a 4GB card, then 2GB of it is currently inaccessible and you only have about 300 MB to play with. The other 1.7GB is there but currently inaccessible. It seems a lot but installing SDL will drop your free space by over 60MB.

It's possible to reclaim that extra space on the card. But this is potentially dangerous so make sure you've got everything backed up first.

There are a couple of ways to get this unused space back. Use the gparted utility on another Linux box, or follow Peter Mount's using the full space on your SD Card. He uses SSH so you'll need to use Putty for this.

Root and Passwords

There is no root password on Debian Squeeze. All the major terminal commands use sudo before them which runs them as root so for example:

sudo apt-get

This runs apt_get as root. You can switch into root in two ways:

  1. Just for this command. Use sudo as we've seen
  2. Switch to root user. This uses the su command, short for switch user (or substitute user or even super user)

If you run su without the username, it logs in as root user but you have to run it via sudo su as su by itself will fail.

Once logged in as root you can do dangerous commands like recursively deleting all files and folders from the root. (Do not try this at home or work or anywhere!).

After doing sudo su run startx to get into LXDE. You'll now see a different backdrop to the LXDE GUI and any command that asked for the root password before won't now. Again unless you are really keen to play with these commands, it's generally NOT a good idea unless you know what you are doing.

From the terminal, when you want to switch back to non root login, just do

su pi

If I come across any more tips, I'll add them to this article. If you know any, please let me know and I'll add them here.

  1. About.com
  2. Computing
  3. C / C++ / C#
  4. Linux Programming
  5. Raspberry Pi Programming
  6. Raspberry Pi - Remote Access, Working as Root, SD Cards

©2014 About.com. All rights reserved.