通过终端的OS X WiFi设置?


9

我管理着一大批Mac,它们都通过以太网连接。我想禁用它们的wifi,然后要求管理员更改任何wifi设置(如下图所示)。 在此处输入图片说明 由于我管理了很多,所以我想通过远程桌面管理器推出该设置。这些设置是否有命令行?我知道关闭wifi是可以的,networksetup -setairportpower en1 off但是我似乎找不到需要管理员权限的设置。


我确实找到了一个命令,该命令可以让我完全禁用硬件,并且似乎需要管理员才能使用。也许有人可以确认networksetup -setnetworkserviceenabled 'Airport' off
Brian

我不确定为什么要进行密切投票?它似乎是关于在专业环境中管理台式机
Jacob

Answers:


8

解决方案在于鲜为人知的命令行工具机场

可以在/usr/sbinSnow Leopard之前找到(因此可能已经在您的PATH中)了,

对于较新的操作系统,可以在以下位置找到 /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources

在这种情况下,您要发出的命令如下:

sudo airport en1 prefs RequireAdmin=YES

手册页实际上是空的,发出机场--help实际上给您的用法信息少于发出不带任何参数的命令的情况。后者给出以下解释:

Usage: airport <interface> <verb> <options>

  <interface>
  If an interface is not specified, airport will use the first AirPort interface on the system.

  <verb is one of the following:
  prefs   If specified with no key value pairs, displays a subset of AirPort preferences for
      the specified interface.

      Preferences may be configured using key=value syntax. Keys and possible values are specified below.
      Boolean settings may be configured using 'YES' and 'NO'.

      DisconnectOnLogout (Boolean)
      JoinMode (String)
          Automatic
          Preferred
          Ranked
          Recent
          Strongest
      JoinModeFallback (String)
          Prompt
          JoinOpen
          KeepLooking
          DoNothing
      RememberRecentNetworks (Boolean)
      RequireAdmin (Boolean)
      RequireAdminIBSS (Boolean)
      RequireAdminNetworkChange (Boolean)
      RequireAdminPowerToggle (Boolean)
      WoWEnabled (Boolean)

  logger  Monitor the driver's logging facility.

  sniff   If a channel number is specified, airportd will attempt to configure the interface
      to use that channel before it begins sniffing 802.11 frames. Captures files are saved to /tmp.
      Requires super user privileges.

  debug   Enable debug logging. A debug log setting may be enabled by prefixing it with a '+', and disabled
      by prefixing it with a '-'.

      AirPort Userland Debug Flags
          DriverDiscovery
          DriverEvent
          Info
          SystemConfiguration
          UserEvent
          PreferredNetworks
          AutoJoin
          IPC
          Scan
          802.1x
          Assoc
          Keychain
          RSNAuth
          WoW
          P2P
          Roam
          BTCoex
          AllUserland - Enable/Disable all userland debug flags

      AirPort Driver Common Flags
          DriverInfo
          DriverError
          DriverWPA
          DriverScan
          AllDriver - Enable/Disable all driver debug flags

      AirPort Driver Vendor Flags
          VendorAssoc
          VendorConnection
          AllVendor - Enable/Disable all vendor debug flags

      AirPort Global Flags
          LogFile - Save all AirPort logs to /var/log/wifi.log

<options> is one of the following:
  No options currently defined.

Examples:

Configuring preferences (requires admin privileges)
  sudo airport en1 prefs JoinMode=Preferred RememberRecentNetworks=NO RequireAdmin=YES

Sniffing on channel 1:
  airport en1 sniff 1


LEGACY COMMANDS:
Supported arguments:
 -c[<arg>] --channel=[<arg>]    Set arbitrary channel on the card
 -z        --disassociate       Disassociate from any network
 -I        --getinfo            Print current wireless status, e.g. signal info, BSSID, port type etc.
 -s[<arg>] --scan=[<arg>]       Perform a wireless broadcast scan.
                 Will perform a directed scan if the optional <arg> is provided
 -x        --xml                Print info as XML
 -P        --psk                Create PSK from specified pass phrase and SSID.
                 The following additional arguments must be specified with this command:
                                  --password=<arg>  Specify a WPA password
                                  --ssid=<arg>      Specify SSID when creating a PSK
 -h        --help               Show this help

它在macOS Sierra 10.12
Quanlong 2016年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.