ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Solved OSX cli Join hidden network

    IT Discussion
    osx administration
    2
    17
    997
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DustinB3403D
      DustinB3403
      last edited by DustinB3403

      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 using networksetup -setairportnetwork en0 HiddenWifi SuperSecretPassword should work, but it doesn't work.

      Does anyone have any pointers here?

      1 Reply Last reply Reply Quote 1
      • DustinB3403D
        DustinB3403
        last edited by DustinB3403

        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'

        1 Reply Last reply Reply Quote 1
        • DustinB3403D
          DustinB3403
          last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • DustinB3403D
            DustinB3403
            last edited by

            I can manually connect to this network if I go through the damn gui, but I don't want to have to do that. . .

            1 Reply Last reply Reply Quote 0
            • black3dynamiteB
              black3dynamite
              last edited by

              http://osxdaily.com/2011/04/12/connect-wireless-network-command-line/

              networksetup -setairportnetwork en0 HiddenWiFiValley password1 should work.

              DustinB3403D 1 Reply Last reply Reply Quote 0
              • DustinB3403D
                DustinB3403 @black3dynamite
                last edited by

                @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.

                black3dynamiteB 1 Reply Last reply Reply Quote 0
                • black3dynamiteB
                  black3dynamite
                  last edited by

                  On a Mac its en1 not en0 for WiFi.

                  DustinB3403D 1 Reply Last reply Reply Quote 0
                  • black3dynamiteB
                    black3dynamite @DustinB3403
                    last edited by

                    @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.

                    1 Reply Last reply Reply Quote 0
                    • DustinB3403D
                      DustinB3403 @black3dynamite
                      last edited by

                      @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.

                      black3dynamiteB 1 Reply Last reply Reply Quote 0
                      • black3dynamiteB
                        black3dynamite @DustinB3403
                        last edited by

                        @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?

                        DustinB3403D 1 Reply Last reply Reply Quote 0
                        • DustinB3403D
                          DustinB3403 @black3dynamite
                          last edited by

                          @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.

                          1 Reply Last reply Reply Quote 0
                          • DustinB3403D
                            DustinB3403
                            last edited by

                            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.

                            black3dynamiteB 1 Reply Last reply Reply Quote 0
                            • black3dynamiteB
                              black3dynamite @DustinB3403
                              last edited by

                              @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?

                              DustinB3403D 1 Reply Last reply Reply Quote 0
                              • DustinB3403D
                                DustinB3403 @black3dynamite
                                last edited by

                                @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.

                                black3dynamiteB 1 Reply Last reply Reply Quote 0
                                • black3dynamiteB
                                  black3dynamite @DustinB3403
                                  last edited by

                                  @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

                                  DustinB3403D 1 Reply Last reply Reply Quote 1
                                  • DustinB3403D
                                    DustinB3403 @black3dynamite
                                    last edited by

                                    @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.

                                    1 Reply Last reply Reply Quote 0
                                    • DustinB3403D
                                      DustinB3403
                                      last edited by DustinB3403

                                      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'

                                      1 Reply Last reply Reply Quote 1
                                      • DustinB3403D
                                        DustinB3403
                                        last edited by

                                        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.

                                        1 Reply Last reply Reply Quote 0
                                        • 1 / 1
                                        • First post
                                          Last post