Running a Webserver on a Tonido Plug
Running a Webserver on a Tonido Plug - Installing an FTP server on the Tonido Plug PDF Print E-mail
Written by Administrator   
Tuesday, 16 November 2010 20:16
Article Index
Running a Webserver on a Tonido Plug
Getting Started
Installing PlugBox Linux
Installing the Apache Webserver
Installing an FTP server on a Tonido Plug
Apache and Bftp Autostart at Boot
Getting a JDK to run on a Tonido Plug
Compiling Tomcat from source on Plugbox Linux
Getting Tomcat Running After Building It
All Pages
Installing an FTP Server on a Tonido Plug

 I tried

pacman -Ss ftpd

to get a list of all the ftp server packages.  There were a bunch.   I chose bftpd because it was so small.   

pacman -S bftpd

It was quick to install.   Here is the page to the tutorial about how to set it up.

I used my vi insert from clipboard trick to copy the following script to in my root home folder:

 case "$1" in
     echo "Starting bftpd Server"
     /usr/sbin/bftpd -d
     echo "Stopping bftpd Server"
     killall bftpd
     $0 stop
     sleep 1
     $0 start
 echo "usage: $0 {start|stop|restart}"

I did

chmod +x

so I could run it.

However,  I could not run ftp on my pc and log in as root because it didn’t let me.   So I need to create a user.   When you create a user you need to know what groups the user should belong to.   So I read about Arch Linux Groups, and User Management.

So I decided to make myself a user account.   I wanted to be in the following groups

users  - the standard users group
wheel - so I can use ‘sudo’ when I need to.
ftp - so I can write to the /srv/ftp folder
http - not sure what ramifications this has
power - so I can reboot
storage - so I can manage disks.

# useradd -g users -G group1,group2{,...} -m USERNAME

useradd -g users -G wheel,ftp,http,power,storage -m kevin

note:  I'm not sure this step worked, since I found later that I could not sudo, or power down from this account. 
This created a new user named ‘kevin’.   Then I set the password:

passwd kevin

It prompted me for a password.  I couldn’t think of a good one, so I just used my wife’s first name, which is usually a pretty secure choice....

Now I ran putty again on my PC and this time typed ‘kevin’ instead of ‘root’ and logged in as my very own self.

Very cool!  It worked.

Then I could try ftp.   Start ftp server with the script by typing the following in my root shh putty session: start

 This starts up the ftp server.   Then I could use FTP from any computer on my network.  I opened a command prompt on a Windows PC, and typed ‘ftp’

Then I could type in ‘kevin’ for my login name and my password I could transfer files to my plug.  The files by default go into my home directory for my kevin account.  I would rather the files go into the /srv/http folder.

So I used the vi editor to edit the file   /etc/bftpd.conf

Near line 130 I changed the ROOTDIR from

  ROOTDIR = “%h”


  ROOTDIR = “/srv”

I also skipped down near the end of the file to the user ftp section

I changed

I don’t see any reason why I’d want anonymous ftp users on my system....

Then used my script to start the FTP server up again.  Sure enough, I can now access the /srv folder.

But... I could not upload any files to the http folder.   I had to go back to the root ssh shell, and navigated to my /srv folder to change permissions so anybody can write to the file.   I allow write permission to users of the folder's group. Then I change the group of the http folder to the group named 'ftp'.

cd /srv
chmod 775 http
chgrp ftp http

Now I can write files to my http folder when logged in as kevin via ftp.   This allows members of the group to write to the http folder, and sets the group of the file to the ‘ftp’ group of which kevin is a member.

So then I uploaded a simple index.html file to the http folder using ftp.  I also created an images folder and uploaded an image that was referenced in my HTML.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

<html xmlns="" xml:lang="en" lang="en">

 <title>Kevin's Tonido Plug Server</title>

<h1>Kevin's Tonido Plug Server</h1>
<p>Welcome to the first page ever served by my Tonido Plug!</p>
<a href=""><img src="/images/tonido_plug_hardware.png" width="294" height="357" border="0" alt="tonido plug"></a>


 First Real Page Served By Plugbox Linux on my Tonido Plug

 Tada!  This page was actually accessed from the outside world, since I had configured port forwarding on my router to open port 80 to point to my Tonido plug. This was really easy to do with my Netgear Rangemax wireless router. On the router's web page there is a port forwarding page where I just needed to specify which port I wanted to open, and which local IP address it should be forwarded to.

   On the next page I'll install Python and configure the system so Apache and the FTP server get started each time the system boots, instead of having to start them manually.


Last Updated on Wednesday, 01 December 2010 14:06

Sponsored Links

Bold Inventions, Powered by Joomla!; Joomla templates by SG web hosting