Forum Discussion
Marcel_Kuiper_5
Nimbostratus
Jun 22, 2007Adding users on 9.1.2
Hi,
Since we're changing account names I need to create a lot of users on all of our BigIP systems. However my perl scripting is not succesful so far which has probably to do with the way I pass data to the call -- yes I'm clueless --. I try with this snippet of code:
$soap = SOAP::Lite
-> uri('urn:iControl:Management/UserManagement')
-> readable(1)
-> proxy("$sProtocol://$sHost:$sPort/iControl/iControlPortal.cgi");
eval {
$soap->transport->http_request->header
(
'Authorization' =>
'Basic ' . MIME::Base64::encode("$sUID:$sPWD", '')
);
};
$user{'name'} = "tester1";
$user{'full_name'} = "tester1 123";
$UserInfo{'user'} = $user;
$UserInfo{'role'} = 0;
$UserInfo{'password'} = "*LCK*";
$UserInfo{'home_directory'} = "/home/tester1";
$UserInfo{'login_shell'} = "/bin/bash";
$UserInfo{'user_id'} = 0;
$UserInfo{'group_id'} = 500;
$users[$i++] = $UserInfo;
$soapResponse = $soap->create_user(
SOAP::Data->name(
'users' => @users
)
);
I can see in my logs that iControl receives the call. However no user is created. My tcpdump is not showing the XML i expected as well (no user name, etc)
Some helpful hints would be more then welcome
Cheers
Marcel
- Marcel_Kuiper_5
Nimbostratus
Ah, found some sample code on this forum, but I still can't get it to work. Code now looks like: - Marcel_Kuiper_5
Nimbostratus
THNX Joe that did it! - Great! Please post again if anything else comes up.
- Daedulus69_1036
Nimbostratus
I am trying to do the same thing in powershell. I am able to following: - Ahh, some fun PowerShell stuff!
$ic = Get-F5.iControl $userInfo = New-Object -TypeName iControl.ManagementUserManagementUserInfo $userInfo.user = New-Object -TypeName iControl.ManagementUserManagementUserID $userInfo.user.name = "testaccount" $userInfo.user.full_name = "Joe User" $userInfo.role = "USER_ROLE_ADMINISTRATOR" $userInfo.password = "foobar" $userInfo.home_directory = "/home/joeuser" $userInfo.login_shell = "/bin/bash" $userInfo.user_id = 0 $userInfo.group_id = 500 $ic.ManagementUserManagement.create_user( (,$userInfo) )
- Daedulus69_1036
Nimbostratus
Thanks Joe, that works great. - Daedulus69_1036
Nimbostratus
Sorry I guess I needed to be more clear. The $userinfo.role = USER_ROLE_TRAFFIC_MANAGER still grants Console access. ie I create this user and then go to the Web GUI and the user has console access enabled. I don't really want to hack it and set the login_shell to something false. - Daedulus69_1036
Nimbostratus
I want to set the correct value so that if an admin in the GUI wanted to change it they would just have to uncheck the box. - Actually, From what I can tell, the The GUI just changes the login shell depending on what you have selected for Console Access
Disabled => /bin/false
$ic = Get-F5.iControl $um = $ic.ManagementUserManagement $um.set_login_shell( (,"joeuser"), (,"/bin/false") )
- Daedulus69_1036
Nimbostratus
Thanks for the confirmation joe
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects