Mineos in Docker /var/games/mineos permissions

Hi, I am running Mineos in a docker and I setup consitent volume for /var/games/mineos but when I imported my old world to this folder I messup the files ownership and permission. Can someone tell me what is the proper group-owner and permission setup for this volume?

If you’re referring to the permissions of your volume on your docker host itself (as opposed to the docker guest), we cannot tell you definitively the command, but we can definitely work it out.

I’ll show you my volume, and hopefully we can glean the changes necessary for you:

DOCKER HOST

[user@dev:/var/lib/docker/volumes/mineos]$ ls -la */*
_data/archive:
total 0
drwxrwxr-x. 4 root root 36 Jun 24 10:11 .
drwxr-xr-x. 8 root root 95 Jun 24 10:07 ..
drwxrwxr-x. 2 will will  6 Jun 24 10:04 116serv
drwxrwxr-x. 2 will will  6 Jun 24 10:11 117serv

[snip]

_data/servers:
total 4
drwxrwxr-x. 4 root root   36 Jun 24 10:11 .
drwxr-xr-x. 8 root root   95 Jun 24 10:07 ..
drwxrwxr-x. 4 will will 4096 Jun 26 16:14 116serv
drwxrwxr-x. 4 will will  255 Jun 24 09:54 117serv

STILL DOCKER HOST

[user@dev:/var/lib/docker/volumes/mineos]$ ls -lan */*
_data/archive:
total 0
drwxrwxr-x. 4    0    0 36 Jun 24 10:11 .
drwxr-xr-x. 8    0    0 95 Jun 24 10:07 ..
drwxrwxr-x. 2 1000 1000  6 Jun 24 10:04 116serv
drwxrwxr-x. 2 1000 1000  6 Jun 24 10:11 117serv

[snip]

_data/servers:
total 4
drwxrwxr-x. 4    0    0   36 Jun 24 10:11 .
drwxr-xr-x. 8    0    0   95 Jun 24 10:07 ..
drwxrwxr-x. 4 1000 1000 4096 Jun 26 16:14 116serv
drwxrwxr-x. 4 1000 1000  255 Jun 24 09:54 117serv

Notice that the files show as being owned by root and will. will is a user that exists only on the docker host, and does not exist in the docker guest (would not work in the webui).

So instead we use ls -lan (specifically using -n which means Numeric).

We can now see that the docker daemon is running the MineOS container and creating files as user 1000.–inside, my mc user is UID 1000, outside, it’s still 1000 (but it’s an unrelated user, will).

Therefore, if I wanted to correct/restore these permissions, I would be able to do this, again from the docker host:

chown -R 1000:1000 /var/lib/docker/volumes/mineos/_data/*/*

The meaning of this command is to -recursively change the owner to user:group 1000:1000 for all the directories at 2 depth farther than _data.

In the MineOS guest, /var/games/minecraft/servers is owned by root; this needs to be preserved. By using /*/* we ensure that we only change the directories we need to:

/var/games/minecraft   # should be owned by root, both in guest and host
/var/games/minecraft/servers   # should be owned by root, both in guest and host
/var/games/minecraft/servers/117serv   # should be owned by `1000`, in guest and host

If you don’t like huge chown commands, then just chown each server you want to modify:

chown -R 1000:1000 /var/games/minecraft/servers/117serv
chown -R 1000:1000 /var/games/minecraft/archives/117serv
chown -R 1000:1000 /var/games/minecraft/backup/117serv

That was really hlepfull. btw your work is really appreciated hexparrot.