How to Set Up a Simple File Sharing Server Over LAN [Ubuntu]

At your workplace, you often have to share files on your computer with other people on the same LAN as your computer. To enable this, you might have to temporarily change folder sharing properties or drag files to a shared folder. An alternative for Ubuntu computer users is to simply start a file sharing server from the file sharing folder. Other people on your LAN can then access the folder’s file through their web browsers as long as you have the server running.

The first step is to open your Terminal. Next, you need to enter the directory that includes the files which you want to share with others over LAN. When you are in the directory, type in the following command:

python -m SimpleHTTPServer

Simple Ubuntu Server 1

When you type in that command, you will view a message that notifies you of the server’s initiation. For example, something like “Serving HTTP on port 8000…” might be shown.

Simple Ubuntu Server 2

The “” indicates “localhost” thus you can open any one of your installed web browsers and access your file server from their via the localhost. All you need to do is type in “localhost” in the address bar followed by a colon sign and then by the port number of the server.

Simple Ubuntu Server 3

Visiting the abovementioned localhost address will list all the files in your selected file directory, available for reading. Others on your LAN can access the server simply by replacing the “localhost” part of the URL by your system’s IP address.

When access requests are made to your server, the logs can be viewed from the Terminal window. The IP address of the request is displayed, along with its date and exact time.

Simple Ubuntu Server 4

By default, the port used for the server is 8000. But this can be modified by changing the original terminal command to the following:

python -m SimpleHTTPServer <port number>

Furthermore, for later versions of Python, you might want to replace the “python -m SimpleHTTPServer” syntax with “python3 -m http.server” – the method of adding the port number remains unchanged.

Simple Ubuntu Server 5

And in this simple way, users on the same LAN such as your Ubuntu computer are able to access any files that are available in the folder that you are running the server from. To exit the server anytime, simply use the “Ctrl+C” interrupt.

Note that if you face any problems while accessing the server from another computer, you might need to check the firewall and port forwarding settings of the networking router that you are using.

If you have easier ways of running a simple file sharing server from Ubuntu or even Windows, let me know in the comments section.



Share this post

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.