Install ULX and ULib on Garry's Mod
Install ULX and ULib on your Linux Garry's Mod server: first superadmin, groups, privileges, sanctions, administrator backup, updates and troubleshooting.
On this page
Your values
Enter them once and the commands in this guide update.
This guide explains how to install ULX, the Garry's Mod administration mod, with its ULib library, then how to appoint your administrators, create groups and give them precise privileges.
HostMyServers does not offer managed game hosting: you administer this server yourself on your VPS or dedicated server.
Prerequisites
- A server installed with the Create a Garry's Mod Server guide. This guide builds on its
gmoduser, the/home/gmod/gmod-serverfolder and thegmod.serviceservice - The
/home/gmod/backup.shscript, described in the Automatic Backup section of that same guide - SSH access with
sudo - RCON configured and TCP port 27015 allowed from your IP address, or an account already declared
superadmininsettings/users.txt - Your SteamID in the
STEAM_0:X:XXXXXXXXformat, visible with thestatuscommand once connected
File Layout
All paths below start from /home/gmod/gmod-server/garrysmod.
| Item | Location | Role |
|---|---|---|
| ULib | addons/ulib |
Library required by ULX |
| ULX | addons/ulx |
Administration commands and menu |
| Users and bans | sv.db |
SQLite tables ulib_users and ulib_bans |
| Groups | data/ulib/groups.txt |
Groups and their privileges |
| User copies | data/ulib_backups |
Copies created by ULib at startup |
| ULX configuration | data/ulx/config.txt |
Welcome message, logs, votes |
| ULX logs | data/ulx_logs |
History of actions |
The files in data/ulx and data/ulib are created at first startup with the addons.
Step 1: Back Up the Server
sudo systemctl stop gmod.service
sudo -u gmod /home/gmod/backup.sh
sudo -u gmod ls -lh /home/gmod/backupsThe most recent archive must carry today's date. It contains sv.db, data, settings and addons, among other things.
Step 2: Install ULib and ULX
Open a session as the gmod user, then fetch the official repositories into the addons folder:
sudo -iu gmod
cd ~/gmod-server/garrysmod/addons
git clone https://github.com/TeamUlysses/ulib.git ulib
git clone https://github.com/TeamUlysses/ulx.git ulxCheck the resulting structure:
ls ulib/lua/autorun/ulib_init.lua ulib/lua/ulib/init.lua ulx/lua/ulib/modules/ulx_init.lua ulx/lua/ulx/init.lua
exitAll four files must be displayed without error. The ulib and ulx folders must stay in lowercase.
Step 3: Start the Server and Check Loading
A full restart is required: simply changing the map is not enough.
sudo systemctl start gmod.serviceWait for loading to finish, then look for the messages from the two addons:
sudo journalctl -u gmod.service -n 500 --no-pager | grep -E 'Ulysses Library|ULX Admin Mod'The Ulysses Library and ULX Admin Mod lines confirm they loaded. Then check that the data files were created:
sudo -u gmod ls /home/gmod/gmod-server/garrysmod/data/ulib /home/gmod/gmod-server/garrysmod/data/ulxStep 4: Appoint the First Superadmin
The superadmin group has access to all commands. Choose the method that fits your situation.
Through RCON
From the game console, replacing the example values:
rcon_address SERVER_IP:27015
rcon_password YourPassword
rcon ulx adduserid "STEAM_0:X:XXXXXXXX" superadminIf You Are Already a Superadmin in users.txt
If your account is listed in settings/users.txt, connect and register it in ULX from the game console:
ulx adduser "YourNickname" superadminCheck the Result
Reconnect to the server, then type in the game console:
ulx whoYour account must appear in the superadmin group. Then type !menu in the chat: the XGUI administration menu opens. The ulx menu command does the same from the console.
Step 5: Create a Group
ULX provides these groups:
| Group | Inherits from | Can target |
|---|---|---|
user |
None | Everyone |
operator |
user |
Players below the admin level |
admin |
operator |
Players below the superadmin level |
superadmin |
admin |
Everyone |
To create a moderator group that can only kick players, type these commands in the game console with your superadmin account:
ulx addgroup moderator operator
ulx groupallow moderator "ulx kick"
ulx setgroupcantarget moderator "!%admin"
ulx adduser "ModeratorNickname" moderatorThe !%admin target prevents the group from targeting administrators and higher groups.
To check, connect with the moderator's account and run ulx help in the console: the list only shows the commands this account has access to. Trying an unauthorized command returns You don't have access to this command.
Managing Privileges and Members
| Command | Effect |
|---|---|
ulx adduser "Nickname" group |
Adds a connected player to a group |
ulx adduserid "STEAM_0:X:XXXXXXXX" group |
Adds a player by SteamID, even if absent |
ulx removeuser "Nickname" |
Removes all privileges from a connected player |
ulx removeuserid "STEAM_0:X:XXXXXXXX" |
Removes all privileges by SteamID |
ulx groupallow group "ulx command" |
Grants a privilege to a group |
ulx groupdeny group "ulx command" |
Removes a privilege from a group |
ulx userallow "Nickname" "ulx command" |
Grants a privilege to a player |
ulx userdeny "Nickname" "ulx command" |
Removes a privilege from a player |
ulx removegroup group |
Deletes a group |
ulx usermanagementhelp |
Displays detailed help on privileges |
Using ULX Day to Day
Commands are used in the console (ulx kick) or in the chat (!kick).
| Console | Chat | Effect | Default access |
|---|---|---|---|
ulx kick "Nickname" reason |
!kick |
Kicks a player | admin |
ulx ban "Nickname" 60 reason |
!ban |
Bans for 60 minutes, 0 for a permanent ban |
admin |
ulx banid "STEAM_0:X:XXXXXXXX" 60 reason |
!banid |
Bans by SteamID | superadmin |
ulx unban "STEAM_0:X:XXXXXXXX" |
!unban |
Lifts a ban | admin |
ulx map map_name |
!map |
Changes the map | admin |
ulx noclip |
!noclip |
Enables or disables free flight | admin |
ulx spectate "Nickname" |
!spectate |
Watches a player | admin |
You can target several players with these keywords: ^ for yourself, @ for the player you are looking at, * for everyone, #group for the members of a group and %group for that group and the ones that inherit from it. A ! placed in front inverts the selection.
Configuring ULX
Open the configuration file:
sudo -u gmod nano /home/gmod/gmod-server/garrysmod/data/ulx/config.txtHere are a few useful settings. Lines starting with ; are comments.
ulx showMotd 0
ulx welcomemessage "Welcome to %host%, map %curmap%."
ulx logFile 1
ulx logDir "ulx_logs"| Setting | Effect |
|---|---|
ulx showMotd |
Message on connection: 0 disabled, 1 file, 2 built-in generator, 3 web address |
ulx welcomemessage |
Welcome message, empty to disable it |
ulx logFile |
Saves logs to a file |
ulx logDir |
Logs folder, under garrysmod/data |
Restart the server to apply the changes:
sudo systemctl restart gmod.serviceFor a setting specific to a gamemode, create data/ulx/gamemodes/darkrp/config.txt, adapting the gamemode name. If you use DarkRP, also see Install and Configure DarkRP on Garry's Mod.
Backing Up Administrators
ULib copies the user list to data/ulib_backups at every startup. You can also run these commands through RCON:
rcon ucl_backup_users force
rcon ucl_restore_users latestThe first creates an immediate copy. The second replaces the current list with the most recent copy: only use it if there is a problem. These copies complement backup.sh, which remains your real backup.
Updating ULib and ULX
Always update both addons together, noting their version first:
sudo systemctl stop gmod.service
sudo -u gmod /home/gmod/backup.sh
sudo -iu gmod
cd ~/gmod-server/garrysmod/addons
git -C ulib rev-parse HEAD > ~/ulib-before-update.txt
git -C ulx rev-parse HEAD > ~/ulx-before-update.txt
git -C ulib pull --ff-only
git -C ulx pull --ff-only
exit
sudo systemctl start gmod.serviceThen repeat the checks from step 3 and run ulx who in game.
Rolling Back
Go Back to the Previous Version
An update may change the data format. So also restore the archive created just before, replacing its name:
sudo systemctl stop gmod.service
sudo -iu gmod
cd ~/gmod-server/garrysmod/addons
git -C ulib reset --hard "$(cat ~/ulib-before-update.txt)"
git -C ulx reset --hard "$(cat ~/ulx-before-update.txt)"
tar -xzf ~/backups/gmod_YYYY-MM-DD_HH-MM-SS.tar.gz -C ~/gmod-server/garrysmod sv.db data
exit
sudo systemctl start gmod.serviceChanges made since this archive, such as new bans, are lost.
Disable ULX
sudo systemctl stop gmod.service
sudo -iu gmod
mkdir -p ~/disabled-addons
mv ~/gmod-server/garrysmod/addons/ulx ~/gmod-server/garrysmod/addons/ulib ~/disabled-addons/
exit
sudo systemctl start gmod.serviceThe server then goes back to Garry's Mod's settings/users.txt list.
Troubleshooting
The ulx Command Is Unknown
- Check that the server was restarted after installation
- Check the files from step 2: a wrongly named or nested folder, such as
addons/ulx/ulx, prevents loading - Check that ULib is present: ULX does not work without it
- Look for errors:
sudo journalctl -u gmod.service -n 500 --no-pager | grep -iE 'ulib|ulx|\[error\]'
Bad RCON password
The password entered does not match rcon_password in server.cfg. If the connection does not go through at all, check that your IP address is allowed on TCP port 27015.
Invalid steamid.
The SteamID is malformed. Copy it from the status command and keep the quotes.
invalid group "..." specified
The group does not exist. Check its spelling, or create it with ulx addgroup.
You don't have access to this command
Your account does not have this privilege. Check your group with ulx who, and reconnect if you just changed it.
No player with id "..." exists in the ULib user list
This SteamID has no registered privileges. There is therefore nothing to remove.
An Administrator Gets Their Group Back After Losing It
They are still listed in settings/users.txt, or in GM.Config.DefaultPlayerGroups if you use DarkRP. Remove them from these lists, then restart the server.
The users database failed to load.
ULib cannot read its table in sv.db. The next message, Error while querying database was:, gives the cause. Check the disk space with df -h, then restore sv.db from your latest archive, with the server stopped.
ULib's users.txt File No Longer Changes
This is normal: recent versions of ULib store users in sv.db. Some documentation still mentions the old file. Use the ulx adduser and ulx adduserid commands.
FAQ
Can I install ULX from the Workshop?
Yes, with IDs 557962238 for ULib and 557962280 for ULX, to add to your collection. Then remove the addons/ulib and addons/ulx folders to avoid having two copies.
Does ULX replace FAdmin on DarkRP?
The two tools are independent. FAdmin ships with DarkRP. If you prefer to use only ULX, you can disable it with ["fadmin"] = true, in disabled_defaults.lua.
Where can I find the full list of commands?
Run ulx help in the console, or see the Ulysses project website.