From bd582ed5ff2d6c8c6a4c220b7ae0261b369e5aa4 Mon Sep 17 00:00:00 2001 From: IrishDarkshadow Date: Fri, 28 Aug 2020 16:33:26 +0100 Subject: [PATCH] Written by Aconite --- ...mit-Admin-Commands-To-Specific-Accounts.md | 78 ++++++++++++++----- 1 file changed, 57 insertions(+), 21 deletions(-) diff --git a/Enabling-Admin---God-Mode-Restriction---Limit-Admin-Commands-To-Specific-Accounts.md b/Enabling-Admin---God-Mode-Restriction---Limit-Admin-Commands-To-Specific-Accounts.md index c04db54..136125f 100644 --- a/Enabling-Admin---God-Mode-Restriction---Limit-Admin-Commands-To-Specific-Accounts.md +++ b/Enabling-Admin---God-Mode-Restriction---Limit-Admin-Commands-To-Specific-Accounts.md @@ -1,23 +1,59 @@ -If you are going to have other players on your server you may not want them to have access to the god mode / admin commands. This guide will show you how to restrict those functions to accounts you have to explicitly authorise. +## Controlling and Restricting Admin (God Mode) Access -To keep the variables limited I'm going to assume that you are starting with a freshly extracted and configured virtual machine. +Your `localOptions.cfg` file (located at `swg-main/exe/linux/localOptions.cfg` is the main configuration file for the server and contains several options related to who has admin permissions. By default in a fresh VM, you will see the following: +```ini +[GameServer] +#adminAccountDataTable=datatables/admin/stella_admin.iff +adminGodToAll=true +adminGodToAllGodLevel=50 +``` +* `adminAccountDataTable` is the path to the compiled datatable (.iff) that contains the list of admin accounts. +* `adminGodToAll` means that every account will have god permissions if this is set to `true`. If you comment this line out by prepending it with a `#` or set it to `false`, no accounts will have admin rights unless they are in the admin table and you uncomment that line. +* `adminGodToAllLevel` is the level of permissions that god characters have if they get god permissions by adminGodToAll (this setting is irrelevant if adminGodToAll is disabled). Level `50` will have access to every admin command and permission. The god level and command permissions structure is outside the scope of this guide and it's messy so you probably don't want to bother with it anyways. Just use 50. +As you can tell, by default on a fresly setup server, every account that is created will have admin permissions at god level 50. -* Log onto your server and create two accounts, for this guide I'm using "swg" and "swg2". -* Add characters to both accounts. -* For each character run /setgod and then /script attach test.qatool < OID > (replace the OID with the object ID which is the string of numbers above your character in game) -* Test each character by entering god mode and running /setspeed 5 and then see if they can run very fast -* Within the VM create a new admin table, copy an existing one from here: /home/swg/swg-main/dsrc/sku.0/sys.server/compiled/game/datatables/admin/ -* I named my new file swgsource_admin.tab -* Next you should clear out any entries in there already (maybe leave 1 as an example to follow) -* Add a new line for the "swg2" account (remember that account names are case sensitive), save changes -* Edit this file: /home.swg/swg-main/exe/linux/default.cfg -* Comment out the "adminGodToAll=1" entry by placing a # symbol at the front of it (#adminGodToAll=1), save changes -* Edit this file: /home.swg/swg-main/exe/linux/local_options.cfg -* Use Find & Replace - find "stella_admin" and replace it with "swgsource_admin" , should be 3 entries. -* Ensure there are no # symbols in front of any of those three entries. -* In the [GameServer} section of the file comment out the "adminGodToAll=true" and "admintGodToAllGodLevel=50" entries by placing a # symbol in front of each of them, save changes. -* Open up a terminal window and run "cd swg-main" -* Now run "ant compile_tab" (this will compile the new admin file for you) -* Boot up the server -* Log into the swg account and verify that the character there cannot enter god mode (/setgod) -* Log into the swg2 account and verify that the character there can enter god mode and alter speed (/setspeed 5) +Let's say you do not want every account to have admin rights and only certain accounts instead. To do this, we need to modify the admin datatable. The datatable when it has been compiled by the server (.iff file) is not editable, so we'll need to edit the pre-compiled file (.tab). To edit the admin table, go to: `swg-main/dsrc/sku.0/sys.server/compiled/game/datatables/admin/` and find the file called `stella_admin.tab`. Double click to open this file in Mousepad or open it with Notepadqq, whichever you prefer. + +The stella_admin.tab file is a tab-delimited file, meaning each tab between the text accounts for a new column. For the sake of this guide, all you should worry about is changing the username(s) in the file. By default, the file looks like this: +``` +AdminAccounts AdminLevel AdminSkill AdminComment AdminComment2 AdminIpBlocks AdminIpComment AdminSuid OldAdminSuid +s i{0} s c c s c i{0} i{0} +swg 50 admin all account names must be lower case main admin account 1 +swg2 50 admin main admin account 2 +swg3 50 admin main admin account 3 +swg4 50 admin main admin account 4 +swg5 50 admin main admin account 5 +``` +**DO NOT EDIT THE FIRST TWO ROWS** + +Where you see "swg" and "swg2", etc., replace those with the account username(s) you want to have god access and be sure to remove any additional rows so the pre-populated accounts don't have admin. **Remember that usernames are case sensitive.** *You do not need to edit anything else*. + +So your new file should look something like: +``` +AdminAccounts AdminLevel AdminSkill AdminComment AdminComment2 AdminIpBlocks AdminIpComment AdminSuid OldAdminSuid +s i{0} s c c s c i{0} i{0} +aconite 50 admin all account names must be lower case main admin account 1 +irish 50 admin main admin account 2 +seefo 50 admin main admin account 3 +``` + +When you have finished making your edits, in your console, make sure you are in the `swg-main` directory, (If you don't know where you are, you can type `cd` then `cd swg-main`). And finally type the command `ant compile_tab`. You should see a message like this return: +``` +[apply] SUCCESS creating data table: /home/swg/swg-main/data/sku.0/sys.server/compiled/game/datatables/admin/stella_admin.iff` + +BUILD SUCCESSFUL +``` +This means you have successfully compiled your modified tab into a datatable! Now all that is left is to change your configuration settings in `localOptions.cfg`. + +* First, comment out `adminGodToAll` and `adminGodToAllLevel` by adding a `#` in front of them, then uncomment the `adminAccountDataTable` line so it looks like this: +```ini +[GameServer] +adminAccountDataTable=datatables/admin/stella_admin.iff +#adminGodToAll=true +#adminGodToAllGodLevel=50 +``` +**There are 2 other places you need to uncomment `adminAccountDataTable` under the `[ConnectionServer]` and `[LoginServer]` headers as well. Don't forget to do this part.** + +Finally, save your `localOptions.cfg` file, and restart (or start) your server, and you're all set. + +To check that your changes have worked correctly, you can turn on god mode with `/setGod` once you have logged into a character on your account and type `/setSpeed 10`. If you can now move very quickly and you get a system message saying your speed has been modified, you have god mode. Then try creating another account and you should not be able to use those commands.