183
Chapter 14: Command Line Configuration
14.1.2 Adding and removing Users
Firstly,determinethetotalnumberofexistingUsers(ifyouhavenoexistingUsersyoucanassumethisis0):
# config -g config.users.total
This command should display config.users.total 1.Notethatifyouseeconfig.users.totalthismeansyouhave0Users
configured.
YournewUserwillbetheexistingtotalplus1.Soifthepreviouscommandgaveyou0thenyoustartwithusernumber1,if
you already have 1 user your new user will be number 2 etc.
Toaddauser(withUsername=John,Password=secretandDescription =mySecondUser)issuethecommands:
# config -s config.users.total=2 (assuming we already have 1 user configured)
# config -s config.users.user2.username=John
# config -s config.users.user2.description=mySecondUser
# config -P config.users.user2.password
NOTE:The-Pparameterwillprompttheuserforapassword,andencryptit.Infact,thevalueofanycongelementcan
beencryptedusingthe-Pparameter,butonlyencrypteduserpasswordsandsystempasswordsaresupported.Ifanyother
elementvalueweretobeencrypted,thevaluewillbecomeinaccessibleandwillhavetobere-set.
Toaddthisusertospecicgroups(admin/users):
# config -s config.users.user2.groups.group1='groupname'
# config -s config.users.user2.groups.group2='groupname2'
etc...
To give this user access to a specific port:
# config -s config.users.user2.port1=on
# config -s config.users.user2.port2=on
# config -s config.users.user2.port5=on
etc...
To remove port access:
# config -s config.users.user2.port1='' (thevalueisleftblank)
or simply:
# config -d config.users.user2.port1
Theportnumbercanbeanythingfrom1to48,dependingontheavailableportsonthespecicConsoleServer.
For example assume we have an RPC device connected to port 1 on the Console Server and the RPC is configured. To give this
useraccesstoRPCoutletnumber3ontheRPCdevice,runthe2commandsbelow:
# config -s config.ports.port1.power.outlet3.users.user2=John
# config -s config.ports.port1.power.outlet3.users.total=2 (total number of users that have access to this outlet)
Ifmoreusersaregivenaccesstothispoweroutlet,thenincrementthe'cong.ports.port1.power.outlet3.users.total'element
accordingly.
Togivethisuseraccesstonetworkhost5(assumingthehostiscongured):
# config -s config.sdt.hosts.host5.users.user1=John
# config -s config.sdt.hosts.host5.users.total=1 (total number of users having access to host)
To give another user called 'Peter' access to the same host:
# config -s config.sdt.hosts.host5.users.user2=Peter
# config -s config.sdt.hosts.host5.users.total=2 (total number of users having access to host)
Toeditanyoftheuserelementvalues,usethesameapproachaswhenaddinguserelementsi.e.usethe'-s'parameter.If
anyofthecongelementsdonotexist,theywillautomaticallybecreated.
TodeletetheusercalledJohn,usethedelete-nodescript:
# ./delete-node config.users.user2
The following command will synchronize the live system with the new configuration:
# config -r users