I'm using a hotspot on Ubuntu 17.04 to share my Internet connection with other devices. But when I restart or suspend the computer, I need to activate the hotspot manually each time.

Is there some option, script, or command to launch the hotspot automatically after wakeup?

2 Answers 2


you can do it with Network Manager. Check the name of the connection which represents the hotspot that you want to start when its active or just guest

nmcli con show

then to make it start automatically

nmcli con mod <connection-name> connection.autoconnect yes

test it with reboot

  • 1
    I would add that nmcli con show <connection-name> lists all parameters including autoconnect, so it can be used to check status without rebooting.
    – Lou_is
    Oct 11, 2021 at 7:50

You could open a terminal and type

nmcli device wifi hotspot ssid YOURSSID

If it brings up your Hotspot you could create a file using


to let your Hotspot start on system startup. But I am not sure if this will also do the trick if your machine comes up from suspend.

Maybe then you would need to create two files with

sudo touch /etc/pm/sleep.d/your-script 
sudo touch /lib/systemd/system-sleep/your-script

Edit them both with

sudo -H gedit /lib/systemd/system-sleep/your-script 
sudo -H gedit /etc/pm/sleep.d/your-script

and paste

case "$1" in
    echo "waking up..."
    nmcli device wifi hotspot ssid YOURSSID 

into them. Then you would need to make them both executable with

sudo chmod a+x /etc/pm/sleep.d/your-script
sudo chmod a+x /lib/systemd/system-sleep/your-script

and try your luck again...

The script works on my machine, but as I am connected only wireless and I am using the same name of the SSID for the test of the Hotspot and after a while, even after sleep, the adapter connects to the standard wifi operations and the Hotspot is getting disabled and wifi is getting enabled.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.