Create an option to set the username to use in Web or RPC Server mode #1381

pull/1382/head
nicolargo 2018-12-29 19:10:48 +01:00
parent bd5b12d521
commit 8cf364212e
4 changed files with 20 additions and 10 deletions

1
NEWS
View File

@ -26,6 +26,7 @@ Bugs corrected:
* TypeError on opening (Wifi plugin) #1373
* Some field name are incorrect in CSV export #1372
* Standard output misbehaviour (need to flush) #1376
* Create an option to set the username to use in Web or RPC Server mode #1381
Others:

View File

@ -1,6 +1,6 @@
.\" Man page generated from reStructuredText.
.
.TH "GLANCES" "1" "Dec 27, 2018" "3.1.0_beta" "Glances"
.TH "GLANCES" "1" "Dec 29, 2018" "3.1.0_beta" "Glances"
.SH NAME
glances \- An eye on your system
.

View File

@ -77,9 +77,15 @@ available network interfaces) and TCP port is ``61209``.
In client/server mode, limits are set by the server side.
You can set a password to access to the server ``--password``. By
default, the username is ``glances`` but you can change it with
``--username``. It is also possible to set the password in the
You can set a password to access to the server using the ``--password``.
By default, the username is ``glances`` but you can change it with
``--username``.
If you want, the SHA password will be stored in ``username.pwd`` file.
Next time your run the server/client, password will not be asked. To set a
specific username you can used the -u <username> option.
It is also possible to set the password in the
Glances configuration file:
.. code-block:: ini
@ -93,9 +99,6 @@ Glances configuration file:
localhost=mylocalhostpassword
default=mydefaultpassword
If you ask it, the SHA password will be stored in ``username.pwd`` file.
Next time your run the server/client, password will not be asked.
Central client
^^^^^^^^^^^^^^

View File

@ -194,6 +194,8 @@ Examples of use:
help='define a client/server username')
parser.add_argument('--password', action='store_true', default=False, dest='password_prompt',
help='define a client/server password')
parser.add_argument('-u', dest='username_used',
help='use the given client/server username')
parser.add_argument('--snmp-community', default='public', dest='snmp_community',
help='SNMP community')
parser.add_argument('--snmp-port', default=161, type=int,
@ -315,10 +317,14 @@ Examples of use:
args.username = self.__get_username(
description='Enter the Glances server username: ')
else:
# Default user name is 'glances'
args.username = self.username
if args.username_used:
# A username has been set using the -u option ?
args.username = args.username_used
else:
# Default user name is 'glances'
args.username = self.username
if args.password_prompt:
if args.password_prompt or args.username_used:
# Interactive or file password
if args.server:
args.password = self.__get_password(