friedrith / node-wifi

📶 NodeJS tool to manage wifi (connections, scans)
MIT License
397 stars 161 forks source link

Trouble connecting to networks on debian #7

Closed tslater closed 5 years ago

tslater commented 7 years ago

I get an error Error: Failed to add/activate new connection: (32) 802-11-wireless-security.psk: property is invalid, which is the same error I get if I try and connect via nmcli dev wifi con "MY_SSID" password "MY_PASSWORD".

friedrith commented 7 years ago

Please give your version of debian. nmcli seemed to be good cli interface a priori but it is quite mis configured in some distributions.

tslater commented 7 years ago

Does this work on some distros? Which ones? I am in an embedded environment, but I might be able to just switch. I'm on Debian 8.3

Distributor ID: Debian
Description:    Debian GNU/Linux 8.3 (jessie)
Release:        8.3
Codename:       jessie
friedrith commented 7 years ago

It works in Ubuntu but not on debian nor raspbian. It is a issue to resolve but I would like to resolve it with keeping nmcli instead of using another command line tool. I already tried a quite long time but nmcli is not well configured in few distributions.

friedrith commented 7 years ago

If you have any idea how to manage it on debian, I will integrate in the project without a doubt.

tslater commented 7 years ago

I've been looking into it and haven't found a way with nmcli. I'll keep looking and let you know if I find anything!

On Tue, Feb 14, 2017 at 2:30 AM, Thibault Friedrich < notifications@github.com> wrote:

If you have any idea how to manage it on debian, I will integrate in the project without a doubt.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/elqui-app/node-wifi/issues/7#issuecomment-279654101, or mute the thread https://github.com/notifications/unsubscribe-auth/AAbbLlIWEWVu0UXZgWHmuhOUW8bWlLR7ks5rcXQkgaJpZM4L-BXS .

tslater commented 7 years ago

I have an update here. nmcli works if I do:

nmcli dev wifi con "MY_SSID" password 'MY_PASSWORD' instead of nmcli dev wifi con "MY_SSID" password "MY_PASSWORD". I have a dollar sign in my password. I wonder if that is related?

tslater commented 7 years ago

It also works if I add a \$, must be bash thinking that $ is a variable name? Maybe we need something like this across the commands: http://stackoverflow.com/a/7685469/1629323. What do you think @thibaultfriedrich ?

tslater commented 7 years ago

Calling the escape function on my string before connecting fixes it. Is that something we'd want to add to the code itself?

friedrith commented 7 years ago

Sorry for the absence, do not hesitate to propose a pull request, if it works for you, I will test on our machines before merging it.

friedrith commented 7 years ago

In fact, I will to it today.

friedrith commented 7 years ago

The following function doesn't work at all for me. May you be more accurate of which function works for you.

var escapeShell = function(cmd) {
    return '"'+cmd.replace(/(["\s'$`\\])/g,'\\$1')+'"';
};

Moreover, I already use ' instead of " for password and ssid.

friedrith commented 3 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.