I installed our system (POL 0.99) on Debian Linux, so this should be very similar in Ubuntu.
You should _not_ use root to run POL. Here is a step by step instruction, modify if needed:
1 Create user and group for POL server. It should be a new user and a new group. To administrate POL you could log in as this user, or log in as root and su to this user. I set it up so that one cannot login to the POL user account.
2 Create the POL directory tree in the new accounts home directory. Do not forget to set up the file permissions, since POL will run as your new user. All directories in the new POL tree should belong to user/group POL user and should be set 0750 (rxwr-x---). You could also set the group id bit so that all files copied into this tree automatically belong to the new POL group. You could set up the directory permissions as 0755 (rwxr-x-r-x), which will make all directories world readable, but this is not necessary.
3 Copy all your files (*.src, *.inc, *.em, *.cfg, ...) into this tree where they belong, set owner and group to POL user, and give permissions for owner and group to read. POL will normally only write the save files and the log files, default is ./data (or ./log for the system logs) in the POL tree root directory. So the directory data should allow POL to write - but if you use the values from point 2 this should be okay.
4 Set up configuration (see POL docu) and do not forget to set up ecompile.cfg. Next use the instructions to generate your realm data. If you intend to run more than one POL server at the same time, you should use the realm data for both, if possible, else you only need the files readable in a configurable directory, default is ./realm in the POL root folder.
5 Your tree should look like this:
Here ~ stands for the home directory (/home/poluser for example) of the new POL user, ~/pol is the root folder for you POL installation.
6 Now you are ready to ecompile all your scripts. I use a small batch for this, but the command 'ecompile -u -r scripts -r pkg
' should do. (I do not use the POL distro, so modify this command as needed. Start the ecompile process as the POL user, not as root or any other user, or the compiled scripts will not belong to POL user!)
7 Now copy an empty worldfile or some worldfile you possess into the data directory. (Do not forget to set file ownership and permissions, or POL will be unable to read it!)
8 As the POL user cd to POL root (~/pol) and type pol into the shell: POL should now start up. This is not the ideal way to start it, but you will see if it runs, you will see error messages, and you can log in with a client. (Remember to do this as the POL user, not as root, or all your saves will be root owned!)
9 If this works, you can set up your shard (or copy data from your existing shard) and test it all.
10 As the last step you probably will need to start POL when the system starts. For this you need a startup script. The script goes to /etc/init.d and it needs to be registered with the systems startup mechanism - use your systems docu for this. If you rather wish to start POL manually, you still need the script, but you will start the script by typing its name. The script should be run as the root user
, not as the POL user or it will fail. It sets up the POL server and starts it under the POL user.
Here is my script as an example:
(I use the system command 'start-stop-daemon', pleas look it up in the man pages, it should be here or you can install it.
Start POL manually, name the script 'polstart' for example, and start it as the root user:
The POL user you created is in this examples poluser/polgroup, change this if you used different user- and group-names.
Code: Select all
/sbin/start-stop-daemon --start --verbose --user poluser --name pol --pidfile /var/run/pol.pid --group polgroup /
--startas /home/poluser/pol/pol --chuid poluser --chdir /home/poluser/pol --background --make-pidfile
You can leave out the option --verbose later.
Stop POL manually, the POL server will stop gracefully, and will save the world state. You can modify this so the POL server shuts down gracefully, when your system goes down.
Code: Select all
/sbin/start-stop-daemon --stop --user poluser --name pol --pidfile /var/run/pol.pid --group polgroup --chuid poluser /
--chdir /home/poluser/pol --retry 60
If you want to know if POL server is running, check the pid file (/var/run/pol.pd). This is its purpose. But the pid file will not be removed, if POL crashes, so you need to read it, it contains the process id of your POL server. Check if the process runs.
To start the POL server at system start, you will use the same two commands like above, but you need to integrate them into a script which the systems init-mechanism can use - look into Ubuntus docu.
The advantage of this method: If POL is unsafe (has an exploitable bug), then a hacker cannot break into your system, since the pol process runs with user rights. Never start a process as root, if not absolutely necessary! Also the rights on the directories could be set even more restrictive. And you should isolate the POL user from the rest of the system (i.e. never use the POL users group for other users). This will make the POL user 'world' or 'other' to all other things on your system.
If you are even more paranoid you could also chroot the POL server to its home directory, but this is too complicated to explain here and not needed most of the time...
Hope this helps