" wifi connect <(B)SSID> [password <password>] [wep-key-type key|phrase] [ifname <ifname>]\n"
" [bssid <BSSID>] [name <name>] [private yes|no] [hidden yes|no]\n\n"
" wifi hotspot [ifname <ifname>] [con-name <name>] [ssid <SSID>] [band a|bg] [channel <channel>]\n\n"
- " [password <password>]\n\n"
+ " [password <password>] [--show-password]\n\n"
" wifi rescan [ifname <ifname>] [[ssid <SSID to scan>] ...]\n\n"
));
}
"\n"
"ARGUMENTS := wifi hotspot [ifname <ifname>] [con-name <name>] [ssid <SSID>]\n"
" [band a|bg] [channel <channel>] [password <password>]\n"
+ " [--show-password]\n"
"\n"
"Create a Wi-Fi hotspot. Use 'connection down' or 'device disconnect'\n"
"to stop the hotspot.\n"
"band - Wi-Fi band to use\n"
"channel - Wi-Fi channel to use\n"
"password - password to use for the hotspot\n"
+ "--show-password - tell nmcli to print password to stdout\n"
"\n"
"ARGUMENTS := rescan [ifname <ifname>] [[ssid <SSID to scan>] ...]\n"
"\n"
const char *wifi_mode,
NMDeviceWifiCapabilities caps,
const char *password,
+ gboolean show_password,
GError **error)
{
char generated_key[11];
NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, NM_WEP_KEY_TYPE_KEY,
NULL);
}
+ if (show_password)
+ g_print (_("Hotspot password: %s\n"), key);
+
return TRUE;
}
const char *channel = NULL;
unsigned long channel_int;
const char *password = NULL;
+ gboolean show_password = FALSE;
NMDevice *device = NULL;
int devices_idx;
const GPtrArray *devices;
goto error;
}
password = *argv;
+ } else if (nmc_arg_is_option (*argv, "show-password")) {
+ show_password = TRUE;
} else {
g_string_printf (nmc->return_text, _("Error: Unknown parameter %s."), *argv);
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
nm_connection_add_setting (connection, NM_SETTING (s_wsec));
- if (!set_wireless_security_for_hotspot (s_wsec, wifi_mode, caps, password, &error)) {
+ if (!set_wireless_security_for_hotspot (s_wsec, wifi_mode, caps, password, show_password, &error)) {
g_object_unref (connection);
g_string_printf (nmc->return_text, _("Error: Invalid 'password': %s."), error->message);
nmc->return_value = NMC_RESULT_ERROR_UNKNOWN;
.RE
.TP
.B wifi hotspot [ifname <ifname>] [con-name <name>] [ssid <SSID>] [band a|bg] [channel <channel>]
-.B [password <password>]
+.B [password <password>] [--show-password]
.br
Create a Wi-Fi hotspot. The command creates a hotspot connection profile according to
Wi-Fi device capabilities and activates it on the device. The hotspot is secured with WPA
.RS
.PP
Parameters of the hotspot can be influenced by the optional parameters:
-.IP \fIifname\fP 10
+.IP \fIifname\fP 17
\(en what Wi-Fi device is used
-.IP \fIcon-name\fP 10
+.IP \fIcon-name\fP 17
\(en name of the created hotspot connection profile
-.IP \fIssid\fP 10
+.IP \fIssid\fP 17
\(en SSID of the hotspot
-.IP \fIband\fP 10
+.IP \fIband\fP 17
\(en Wi-Fi band to use
-.IP \fIchannel\fP 10
+.IP \fIchannel\fP 17
\(en Wi-Fi channel to use
-.IP \fIpassword\fP 10
+.IP \fIpassword\fP 17
\(en password to use for the created hotspot. If not provided,
nmcli will generate a password. The password is either WPA
pre-shared key or WEP key.
+.IP \fI--show-password\fP 17
+\(en tell nmcli to print the password to stdout. It is useful
+when the user did not provide his own password.
.RE
.TP
.B wifi rescan [ifname <ifname>] [[ssid <SSID>] ...]