Monthly Archives: May 2015

Wake on LAN for PC’s via Raspberry Pi

I found a nice PHP script for Wake on LAN. I loaded it on the Raspberry Pi that I have and configured it for my system. The Raspberry Pi runs 24/7, so I can just navigate to a web page that it serves, hit a button and start up one of my machines at home from anywhere. Mostly this is useful for the starting my Linux file server remotely but I do use it to fire off the desktop too.

Right from the read me file for the code…

REMOTE WAKE/SLEEP-ON-LAN SERVER
=========================
This is simple webapp that runs on your Raspberry Pi to turn it into a remotely accessible Wake/Sleep-On-LAN Server. [Follow the detailed tutorial](http://www.jeremyblum.com/2013/07/14/rpi-wol-server/) on my website for instructions on how to get this working, and forwarded through a router. This is very useful when you have high-powered machine that you don’t want to keep on all the time, but that you want to keep remotely accessible for Remote Desktop, SSH, FTP, etc.

http://www.jeremyblum.com/2013/07/14/rpi-wol-server/

Results

It is rare when something works right out of the box. But, this did, I followed Jeremy Blum’s instructions and within a few minutes I had this working. It has a nice drop-down menu where you can select a computer. It pings it to see if it is awake, then you can wake it from anywhere in the world. Once the WOL packet is sent, the application keeps pinging the PC at a defined interval and you can see when it wakes. I have not tried the sleep functionality as I am using it with Linux PC’s and his outline covers Windows machines. I am sure the code could me modified to shut down a Linux PC somehow. Perhaps it automatically SSH’s in and sends a shutdown command, something like that. I have my Linux server set to shutdown automatically so I don’t need this functionality myself.

It is configurable through an easily understood config.php file as well. You can set the computers name and IP address, MAC address, timing between pings, amount of times to ping the machine and etc.

Also see on this site…

Original Wake on LAN via Ubuntu Linux Post

Windows Wake on LAN Post

Upgrade from Ubuntu 13.04 to Ubuntu 14.04 LTS in 5 steps

When we got back from house sitting this winter and back into my regular house, I finally got around to installing a newer version of Lubuntu Linux on my desktop at home, I wanted to get away from using Windows XP and didn’t feel like installing a new version of Windows. The original Wildcat video card on the PC didn’t support Linux well, so I installed an old GeForce card I had sitting in a box from a carcass machine. It was a moment where I said, why didn’t I think of this years ago! I first installed Linux 5 years ago on it, saw that the video didn’t work quite right and didn’t really dig any deeper than trying a lot of settings changes, the gave up and lived with it. I used XP heavily on it and I have to admit I was pretty OK with the way XP was working on it, so it was a case of leave it alone if it is OK.

I actually left the other video card ( an expensive Wildcat card, large unit fits the full footprint for the bay. It cost $2K for the company that bought it for CAD/CAM usage originally) in place. I found a setting in the BIOS for Legacy detection of video, it was set to AGP, I switched it to auto, seems to work!

But, now I have it pretty much set up and working good. The machine has 2 identical hard-drives that have copies of the same stuff and 2 copies of Win XP, one on each drive. Plus I back it up to an external server, when I remember to, its been too long already! I can start it in Linux (Lubuntu 14.04 LTS or Ubuntu Server 12.04, for testing) or one of the 2 XP’s, but I am pretty much going to keep using Lubuntu Linux on it, faster than XP was and doesn’t crash, it just works better in general.

Tutorial Page

The tutorial page below  worked well. I had the Lubuntu 13.04 CD for Lubuntu from trying it out on one of my old servers a few years back. I used it to install on my desktop because the unit  doesn’t have a DVD player and Lubuntu 14.04 LTS is just a tad oversized for a CD. When the install was going on I just selected the root directory to go in the same place (on sdb5 in my case) as the old 9.10 Ubuntu install. At this question it was choose OTHER and not side by side or wipe drive for me.

Then I used the steps in the tutorial to migrate from Lubuntu 13.04 to Lubuntu 14.04 LTS. (I did try Lubuntu 15.04 which fits on a CD, but it did not run, checked the disc and MD5 sum too, but it just might not be compatible with the machine). The only things I did above and beyond the tutorial was to run..

sudo apt-get update && sudo apt-get upgrade

…before and after installing Lubuntu 14.04 LTS. And after the final update and upgrade I ran…

sudo apt-get autoremove

…to remove pieces of Lubuntu 13.04 that were not needed with Lubuntu 14.04 LTS.

http://www.tuxtrix.com/2014/03/upgrade-from-ubuntu-1304-to-ubuntu-1404.html

Simple WebDAV

WebDAV, the DAV stands for Distributed Authoring and Version. In its simplest form would be a folder that can be accessed from the web that has a username and password to keep the content locked. There are two versions basically, plain and SSL which is secure in that the data that flows in and out of the folder is encrypted as it moves through the web. In this post I am covering the simple non-SSL form for starters.

This post assumes that Apache is installed, if you need to install it do…

sudo apt-get install apache2

Then load the Apache modules for DAV…

sudo a2enmod dav
sudo a2enmod dav_fs

Create a folder for WebDAV

I created a directory at…

/srv/homes/webdav

…the command…

mkdir -p /srv/homes/webdav

…will allow the folders above webdav, such as homes be created if they do not exist.

Edit the Apache default file

The WebDAV folder access is simply controlled by the sites-available/default file. To edit it run…

sudo nano /etc/apache2/sites-available/default

Towards the bottom of the file right above the section that has the ScriptAlias for the /cgi-bin/ directory, I placed the following code…

Alias /webdav  /srv/homes/webdav
<Location /webdav>
 Options Indexes
 DAV On
 AuthType Basic
 AuthName "webdav"
 AuthUserFile /etc/apache2/webdav.password
 Require valid-user
 </Location>

Adding the Password

Use the htpasswd command to add a password to a webdav.password file. it will prompt you for a password. The file will contain hashed passwords which are not readable.

sudo htpasswd -c /etc/apache2/webdav.password username

For an extra level of protection you can change ownership of the file to root with the group of www-data, so no regular users can access the file. Setting the permission to read-write for owner root and read only for the www-data group…

sudo chown root:www-data /etc/apache2/webdav.password
sudo chmod 640 /etc/apache2/webdav.password

Access the Folder

With everything setup the folder will now appear at http://your-url-here.com/webdav, you can browse to it to test it out. You will be prompted for the user-name and password created earlier in the adding the password step.

Further Potential for WebDAV

  • Setup multiple WebDAV folders.
  • Put a web folder on expanded storage on a Raspberry Pi, such as use a bind mount to point to a USB stick plugged into the Pi for extra storage space.
  • It is possible to set up WebDAV with SSL to secure it in a way that the data flowing in and out of the folder will be secured from prying eyes. With my non-SSL WebDAV folder, I don’t put anything up there that is critical or really private data.
  • It is possible to use DAV for support of calendars across devices, something I will explore in the future.
  • There is an app for the iPhone that I have tried that allows easy uploading and downloading to the WebDAV folder. It is easy to drop attachments from email and etc. to the folder for access on a PC.

Resources

https://www.digitalocean.com/community/tutorials/how-to-configure-webdav-access-with-apache-on-ubuntu-12-04 

WebDAV Resources