Solved OSX cli Join hidden network
-
So the goal here is to avoid having to connect any external USB or Thunderbolt ethernet adapters to these Apple computers.
With that in mind, I'd go and look at the
networksetup
command.So
networksetup -addpreferredwirelessnetworkatindex en0 SSID index SecurityType [password]
should do what I need.IE:
networksetup -addpreferredwirelessnetworkatindex en0 HiddenWifi 1 WPA SuperSecretPassword
should add the network to the list of known networks (it adds something) and then usingnetworksetup -setairportnetwork en0 HiddenWifi SuperSecretPassword
should work, but it doesn't work.Does anyone have any pointers here?
-
So this documentation is just dated or something. So this is what works.
networksetup -addpreferredwirelessnetworkatindex en0 SSID index SecurityType 'SuperSecretPassword'
Turn the interface off next
networksetup -setairportpower en0 off
Then on
networksetup -setairportpower en0 on
Then connect with
networksetup -setairportnetwork en0 SSID 'SuperSecretPassword'
-
Using just
networksetup -addpreferredwirelessnetworkatindex en0 SSID index SecurityType
adds the network as well, and the with the correct type but there is no way to connect to the network.Even with
networksetup -setairportnetwork en0 HiddenWifi SuperSecretPassword
you aren't prompted or able to supply a password in that field.Yet the man documents very clearly show a password prompt with [password] listed in all of the documentation.
-
I can manually connect to this network if I go through the damn gui, but I don't want to have to do that. . .
-
http://osxdaily.com/2011/04/12/connect-wireless-network-command-line/
networksetup -setairportnetwork en0 HiddenWiFiValley password1
should work. -
@black3dynamite said in OSX Cli Join hidden network:
http://osxdaily.com/2011/04/12/connect-wireless-network-command-line/
networksetup -setairportnetwork en0 HiddenWiFiValley password1
should work.Yeah that documentation is old and doesn't work. I've already read it.
-
On a Mac its en1 not en0 for WiFi.
-
@DustinB3403 said in OSX Cli Join hidden network:
@black3dynamite said in OSX Cli Join hidden network:
http://osxdaily.com/2011/04/12/connect-wireless-network-command-line/
networksetup -setairportnetwork en0 HiddenWiFiValley password1
should work.Yeah that documentation is old and doesn't work. I've already read it.
Although its old, its still valid.
-
@black3dynamite said in OSX Cli Join hidden network:
On a Mac its en1 not en0 for WiFi.
en0 based on me looking at the hardware report for my macs.
-
@DustinB3403 said in OSX Cli Join hidden network:
@black3dynamite said in OSX Cli Join hidden network:
On a Mac its en1 not en0 for WiFi.
en0 based on me looking at the hardware report for my macs.
Oh, so Macs you have are the ones without a Ethernet port?
-
@black3dynamite said in OSX cli Join hidden network:
@DustinB3403 said in OSX Cli Join hidden network:
@black3dynamite said in OSX Cli Join hidden network:
On a Mac its en1 not en0 for WiFi.
en0 based on me looking at the hardware report for my macs.
Oh, so Macs you have are the ones without a Ethernet port?
Correct, WiFi only.
-
Which is why I said, it adds the connection, but it fails to connect. I can go into the GUI and connect, but that defeats the point.
I want to add the connection, and connect automatically without having to fuss around with the damn gui.
-
@DustinB3403 said in OSX Cli Join hidden network:
Which is why I said, it adds the connection, but it fails to connect. I can go into the GUI and connect, but that defeats the point.
I want to add the connection, and connect automatically without having to fuss around with the damn gui.
So in the GUI, is auto-join enabled after you add the network?
-
@black3dynamite said in OSX cli Join hidden network:
@DustinB3403 said in OSX Cli Join hidden network:
Which is why I said, it adds the connection, but it fails to connect. I can go into the GUI and connect, but that defeats the point.
I want to add the connection, and connect automatically without having to fuss around with the damn gui.
So in the GUI, is auto-join enabled after you add the network?
Yes, but it doesn't connect. Maybe with a reboot. But that would kind of defeat the point I'm hoping for.
-
@DustinB3403 said in OSX Cli Join hidden network:
@black3dynamite said in OSX cli Join hidden network:
@DustinB3403 said in OSX Cli Join hidden network:
Which is why I said, it adds the connection, but it fails to connect. I can go into the GUI and connect, but that defeats the point.
I want to add the connection, and connect automatically without having to fuss around with the damn gui.
So in the GUI, is auto-join enabled after you add the network?
Yes, but it doesn't connect. Maybe with a reboot. But that would kind of defeat the point I'm hoping for.
Restart the network service instead of rebooting
-
@black3dynamite said in OSX cli Join hidden network:
@DustinB3403 said in OSX Cli Join hidden network:
@black3dynamite said in OSX cli Join hidden network:
@DustinB3403 said in OSX Cli Join hidden network:
Which is why I said, it adds the connection, but it fails to connect. I can go into the GUI and connect, but that defeats the point.
I want to add the connection, and connect automatically without having to fuss around with the damn gui.
So in the GUI, is auto-join enabled after you add the network?
Yes, but it doesn't connect. Maybe with a reboot. But that would kind of defeat the point I'm hoping for.
Restart the network service instead of rebooting
Wooh, now that is an idea.
-
So this documentation is just dated or something. So this is what works.
networksetup -addpreferredwirelessnetworkatindex en0 SSID index SecurityType 'SuperSecretPassword'
Turn the interface off next
networksetup -setairportpower en0 off
Then on
networksetup -setairportpower en0 on
Then connect with
networksetup -setairportnetwork en0 SSID 'SuperSecretPassword'
-
As an additional option, if you don't want your workstation to automatically connect to this network (on startup, while roaming etc) use this
networksetup -removedpreferredwirelessnetwork Interface SSID
That disables the autojoin functionality on OSX 10.14.6, but you would still have connected to the network from the initial answer.