Available since: version 0.9.4
What is User Websites?
User websites is a standard location for webservers to allow host users to expose static files on the filesystem as a website to the local network and/or the internet according to the network and firewall setup.
The standard webserver in FreedomBox is Apache and this is implemented by means of a specific Apache module.
Using User Websites
The module is always enabled and offers no configuration from the FreedomBox web interface. There is no configuration or status page shown for this module in the FreedomBox web interface.
To serve documents, place the files in the designated directory in a FreedomBox user's home directory in the filesystem.
This directory is: public_html
Thus the absolute path for the directory of a user named fbx with home directory in /home/fbx will be /home/fbx/public_html. User websites will serve documents placed in this directory when requests for documents with the URI path "~fbx" are received. For the the example.org domain thus a request for the document example.org/~fbx/index.html will transfer the file in /home/fbx/public_html/index.html.
Creating public_html folder and uploading documents
Visually from Linux
Linux standard desktop file managers use to support remote filesystem access through SFTP out of the box. Among others, Gnome's Nautilus, KDE/Plasma's Dolphin and XFCE's Thunar do so. This standarization allows for very easy, similar and straightforward procedures:
Connect with the file manager to your FreedomBox:
- Gnome's Nautilus:
- To lauch Nautilus you can seek its archive icon, or search ether its name or the word "file".
- At the bottom of the left pane you'll find an option "+ Other locations".
It leads you to a list of locations. Find "freedombox SFTP server" (english literal for all desktop languages). Click on it.
The first time you'll be asked for your user and password. Enter your FreedomBox user and its password. The dialog will also offer you some options to remember it for some time.
- Plasma file manager AKA Dolphin:
- Click on the location bar at the top of the window.
The first time you'll be asked for your user and password. Enter your FreedomBox user and its password. The dialog will also offer you some option to remember it.
- XFCE's Thunar:
Type this into the browser bar: sftp://email@example.com, replacing the 'username' placeholder with your actual FreedomBox username.
I guess the first time you'll be asked for your password. Enter your FreedomBox user's password.
- Gnome's Nautilus:
You should be shown FreedomBox filesystem. Enter the home folder and then enter you user's subfolder.
If there's no public_html folder, create it: right mouse button click, etc.
Drag your file(s) and drop it/'em into the public_html folder.
- You should now be able to navigate your browser to the corresponding url and see the files.
Visually from Other Plattforms
If you want to use graphical free software clients, install:
FileZilla for Mac.
Spider or Ghost Commander, available in F-Droid application repository for Android.
Their usage will be similar to that described for Linux desktops.
With a Command Line Interface (CLI)
Usually any Unix system, including Linux in all (most) of its flavours and Mac, provide the standard utilities ssh, scp and sftp. FreeDOS provides SSH2DOS. No need to install anything. It's already there!
Connect to FreedomBox via SSH:
(replacing username with a valid FreedomBox user name and freedombox.local with your FreedomBox's domain name or IP):
$ ssh firstname.lastname@example.org
If your data is ok and your FreedomBox reachable, the first time you'll be asked to confirm its signature.
Then you'll be asked for the password of your FreedomBox user.
Then you'll be shown the welcome banner with the FreedomBox's buttefly logo in ASCII art (painted with characters).
The prompt changes to username@freedombox:~$.
Once connected create your website folder with:
username@freedombox:~$ mkdir ~/public_html
...or one for another user:
use the sudo prefix like
username@freedombox:~$ sudo mkdir /home/<the_other_user>/public_html, and introduce your password.
When you create a folder, by default it belongs to you no matter where it is created. Thus you'll then need to set its ownership to the other user:
username@freedombox:~$ sudo chown <the_other_user>:<the_other_user> /home/<the_other_user>/public_htm
- Better check it before you disconnect that `public_html' is listed among the contents of the other user's home folder.
username@freedombox:~$ ls -l /home/<the_other_user> ... drwxr-xr-x 2 <the_other_user> <the_other_user> 4096 jan 29 17:39 public_html ...
. The name of the other user must appear twice in the public_html line and its permissions should be drwxr-xr-x.
Then any user can upload their files to their respective folders with any of the graphical clients. Ask them to check it.
It is a good security practice to exit instead of to just wait for the connection to time out:
If then you want to also upload the web content through the command line you can
$ scp path/to/files email@example.com:public_html/
. It will ask your password in FreedomBox. You should then be able to navigate your browser to the corresponding url and see the files.
Learn more about ssh, scp and sftp with $ man ssh, $ man scp and $ man sftp.
Upstream project website: https://httpd.apache.org/docs/2.4/mod/mod_userdir.html
User documentation: https://httpd.apache.org/docs/2.4/howto/public_html.html
Next call: Sunday, August 28 at 17:00 UTC
This page is copyright its contributors and is licensed under the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.