Sharing WiFi On Linux

28 Oct 2017

1.Installing create_ap

To create a WiFi hotspot, we will make use of a handy script available on GitHub. It can be installed on Ubuntu by runnnig the following commands:

$ git clone
$ cd create_ap
$ make install

For other linux distros, take a look at the installation guide.

2.Finding your wireless interface name

The next step (assuming your device is already connected to WiFi) is to find the name of your wireless interface. Run the following command in a console:

$ iwconfig | grep SSID | awk '{print $1}'

This should print out a list of network interfaces with a note beside the ones that do not have an active connection. Running the above command on my laptop gave me the following output:

enp9s0    no wireless extensions.

lo        no wireless extensions.


Since I was connected to WiFi at the time, I was able to conclude that wlp8s0 is the name of my wireless interface.

3.Launching the hotspot

The hotspot can then be launched by running the following command, filling in the relevant fields:

$ sudo create_ap <wireless_interface> <wireless_interface> <hotspot_name> <hotspot_password>

In my case, the filled in command looks something like this:

$ sudo create_ap wlp8s0 wlp8s0 MyHotspot MyPassword


Since the script runs a process in the console, once the terminal is closed the hotspot will be closed as well. To circumvent this consider using a terminal multiplexer such as tmux or screen, which allows you to close a terminal and still have it running in the background.

A simplified workflow using tmux is presented below:

# Create a tmux session called hotspot
$ tmux new -s hotspot

# Run the hotspot (consider aliasing the command below)
> sudo create_ap <wireless_interface> <wireless_interface> <hotspot_name> <hotspot_password>

# Enter your user password when prompted

At this point you may close the terminal window. Alternatively, detach from the terminal by pressing Ctrl + B followed by D.

If you wish to stop the hotspot manually, run the following command in any terminal to kill the tmux session named hotspot:

$ tmux kill-session -t hotspot