ubuntu 12.04 nmcli doesn’t list connections under one no-login user

I am running bacula as my backup system and I would like to run a script before some backup jobs to establish a VPN connection and access some servers that don’t have public IPs.

I have configured a PPTP VPN that I can start successfully with the command

nmcli con up uuid xxxxxxxxxxxxxxxxxx

bacula is also the user under which the program runs filling the disk with the backups, connecting to the servers, etc. Before each job this last command is run, but the output is:

13-Apr 12:58 server_name-dir JobId 3577: BeforeJob: Error: Unknown connection: xxxxxxxxxxxxxxxxxx.

If I list the available connections under my user with

nmcli con list

I get everything as expected. But if I run this command under username “bacula”:

sudo -H -u bacula bash -c 'nmcli con list'

The list comes empty. Also:

sudo -H -u bacula bash -c 'nmcli con up uuid xxxxxxxxxxxxxxxxxx'

Gives the same error message as before:

Error: Unknown connection: xxxxxxxxxxxxxxxxxx

Is there something I should do different? What may be wrong? Why can’t bacula see the connections but my user can? Has it something to do with me being in the sudoers group? I don’t run nmcli with sudo when listing connections so I don’t think that is it.

Answer

To list avaible connection (AP) using nmcli type :

nmcli device wifi list

To get the list of all the available network configurations:

nmcli connection

Attribution
Source : Link , Question Author : rmarques , Answer Author : GAD3R

Leave a Comment