Working with the Container
Xylok is installed by default to /opt/xylok
. However, Xylok itself is running inside a container, via Docker or Podman. This introduces complications on working with it via the command line, because the processes inside the container can only access host files and directories that were explicitly mounted when the container was created. The majority of these mounts are in /var/lib/xylok
and used to store the database and other data. For files that the user needs to access inside the container, a pass-through directory is mounted. On the host, this directory is at /opt/xylok/_passthrough
by default. Inside the container, the same files can be accessed at /_passthrough
.
Generally, to work with files inside the container follow these steps:
- Copy the files to
/opt/xylok/_passthrough
- Run
/opt/xylok/xylok ext fix
to change the owner and permissions to ensure the container can fully access the files.
The reverse is also true. When running a command that produces a file, it cannot write directly to the host. Instead, you should have commands inside the container write to /_passthrough
and then access them on the host from /opt/xylok/_passthrough
.
Some of the scripts described in Helper Scripts help with this process, others do not. The description of each will make note of this.
Inside the container all processes are run as the xylok user. To ensure file permissions are correct, the Xylok Manager will by default attempt to sudo to this user before running commands inside the container. If you receive a permission error in this process, either become root and re-run the command or allow your user to switch to the xylok user (to quickly test, sudo -u xylok -s
will give you a shell as the xylok user if you have the right to switch to this user).
The best option for your system varies, but one possible option is:
- Run
sudo visudo
- Add the line
%xylok ALL=(xylok) NOPASSWD: /opt/xylok/xylok *
to the end (note this allows for users in the xylok group to become the xylok user with no password prompt) - Add your user to the xylok group:
sudo usermod -aG xylok $(id -u -n)
- Logout and back in to activate the new group
If other users also need access to Xylok, add them to the xylok group as well.