From OpenSimulator

Revision as of 23:54, 12 September 2011 by Fritigern (Talk | contribs)

Jump to: navigation, search

Caution ! The RemoteAdmin feature is unsecured at this time. For testing uses only.

How to Setup the Remote Admin

Setup OpenSim

First you should enable the remote admin interface to do so just add the following lines to your OpenSim.ini file Port should be set to a nonzero value to have the remote admin on a different port

enabled = true
access_password = secret
port = 0

Example in C# .NET

This example needs the Nwc.XmlRpc library, located in your OpenSim bin folder.

public void CreateUser(Uri url, string adminPassword, string firstName, string lastName, string password, string email, int regionX, int regionY)
    var address = Dns.GetHostEntry(url.DnsSafeHost).AddressList[0];
    var ht = new Hashtable();
    ht["password"] = adminPassword;
    ht["user_firstname"] = firstName;
    ht["user_lastname"] = lastName;
    ht["user_password"] = password;
    ht["user_email"] = email;
    ht["start_region_x"] = regionX;
    ht["start_region_y"] = regionY;
    var parameters = new List<Hashtable> { ht };
    var rpc = new XmlRpcRequest("admin_create_user", parameters);
public void NativeUserRegistrationTest()
    CreateUser(new Uri(""), "secret", "Test2", "user2", "apassword", "", 0, 0);

Another Example in C# .NET

//Author Ottalese complements of 
//This example needs the CookComputing.XmlRpc library, this can be downloaded from 
//Recently updated code I originally posted, this can be secured using SSL. 
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CookComputing.XmlRpc;
public interface RemoteOpensim&nbsp;: IXmlRpcProxy
 //Create new user
 XmlRpcStruct admin_create_user(XmlRpcStruct Parameters);
public partial class _Default&nbsp;: System.Web.UI.Page
 protected void Page_Load(object sender, EventArgs e)
 protected void SubmitButton_Click(object sender, EventArgs e)
 XmlRpcStruct NewUser = new XmlRpcStruct(); //Will contain return results.
XmlRpcStruct Parameters = new XmlRpcStruct();//Parameters passed.
 RemoteOpensim Admin = XmlRpcProxyGen.Create&lt;RemoteOpensim&gt;();
 Parameters.Add("password", "RemotePassword"); //Password you set in the .ini file for the RemoteAdmin
 Parameters.Add("user_firstname", SomeStringWithFirstName);
 Parameters.Add("user_lastname", SomeStringWithLastName);
 Parameters.Add("user_password", SomePassword);
 Parameters.Add("start_region_x", 0);
 Parameters.Add("start_region_y", 0);
NewUser = Admin.admin_create_user(Parameters); 
foreach (DictionaryEntry ReturnResults in NewUser)
 Response.Write(ReturnResults.Key.ToString() + "&nbsp;: " + d.Value.ToString());//Returns if the user was added or not
 catch (Exception ex)

Example in Python

# Author  : DrScofield 
 # Source  :
 # License : BSD License
 import xmlrpclib  
 # XML-RPC URL (http_listener_port)  
 gridServerURL = ‘′  
 # instantiate server object  
 gridServer = xmlrpclib.Server(gridServerURL)  
 # invoke admin_alert: requires password and message  
 gridServer.admin_broadcast({’password’: ’secret’,   ‘message’: ‘the answer is 42})

RemoteAdmin executable for Windows

The RemoteAdmin executable for Windows is a command line tool based on the RemoteAdmin PHP Class.

Downloads and documentation on the RemoteAdmin Executable webpage

Example in PHP

This example needs the RemoteAdmin PHP Class file available here.

// Author  : Olish Newman
// Source  :
// Licence : BSD License
// Including the RemoteAdmin PHP class. It can be downloaded from the link above.
// Instantiate the class with parameters identical to the Python example above
$myRemoteAdmin = new RemoteAdmin('', 9000, 'secret');
// Invoke admin_broadcast
$parameters = array('message' => 'the answer is 42');
$myRemoteAdmin->SendCommand('admin_broadcast', $parameters);
// Invoke admin_shutdown (example for use without parameters)
// Invoke admin_create_user (multiple parameters)
$parameters = array('user_firstname' => 'Ruth', 'user_lastname' => 'OpenSim', 'user_password' => 'MyPassword', 'start_region_x' => '1000', 'start_region_y' => '1000');
$myRemoteAdmin->SendCommand('admin_create_user', $parameters);

Note: This script does not appear to work for create user because it tries to pass the start region x and y as a string when the RemoteAdmin needs a string. The class needs to be edited to pass it as a number or edit the remoteadmin source to convert the string to a unsigned int.

Another example in PHP5, using CURL.

//This is the slightly modified RPC-class of the BSD-licensed WiXTD webportal
class RemotePC {
	function __construct() {
        $this->serveruri = "http://myhost";
        $this->serverport ="9000";
        $this->password ="foobar";
	function call($command,$parameters) {
        $parameters['password'] = $this->password;
	$request = xmlrpc_encode_request($command, $parameters);
	$ch = curl_init();
	curl_setopt( $ch, CURLOPT_URL, $this->serveruri);
	curl_setopt( $ch, CURLOPT_PORT, $this->serverport]);	
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt ( $ch, CURLOPT_POSTFIELDS, $request);
	curl_setopt ( $ch, CURLOPT_TIMEOUT, 5);	
	$result = curl_exec($ch);
	return xmlrpc_decode($result);

Example in Perl

Because the OpenSim internal web server just accepts HTTP/1.0 requests, it's worth to give a perl example. It's not a daily thing to do HTTP/1.0 within the LWP environment. You can get the Perl example here.

RemoteAdmin Commands

Name Status Description Parameters
Create a new region region_name, region_id (optional), estate_owner_first (optional), estate_owner_last (optional), estate_owner_uuid (optional), listen_ip, listen_port (integer), external_address, region_x (integer), region_y (integer), persist (optional), estate_name (an estate owner must be specified if the estate does not already exist)
Delete a region region_name
Close a region without deleting it. region_name, region_id (optional)
Modify a region region_name, region_id (optional), public, enable_voice
Query the 'health' of a region region_uuid or region_name
Shut down the simulator shutdown (optional, expects 'delayed'), milliseconds
Send a general alert message
Restart Region regionid
Load Height Map filename, regionid
Execute the terrain save command filename, regionid
Create a new user user_firstname, user_lastname, user_password, start_region_x, start_region_y
Create a new user (alias for admin_create_user) user_firstname, user_lastname, user_password, start_region_x, start_region_y
Check whether a certain user account exists user_firstname, user_lastname
Update the password/home of a user account user_firstname, user_lastname, user_password, start_region_x, start_region_y
Execute the Load XML command filename, region_uuid (or region_name), xml_version
Execute the Save XML command filename, region_uuid (or region_name), xml_version
Load a saved OAR file into a region filename, region_uuid (or region_name), merge (optional, use "true"), skip-assets (optional, use "true)
Saved an OAR file of a regions contents filename, region_uuid (or region_name), profile (optinal, use profile url), noassets (optional, use "true"), perm(optinal, use C, T or CT),
Retrieve a list of users who can access the region region_uuid or region_name
Clear the access list for the region region_uuid or region_name
Add a list of users to the access control list region_uuid or region_name, users
Remove a list of users from the access control list region_uuid or region_name, users


Thanks to DrScofield for the Python Script Sources :

Personal tools
About This Wiki