Headless server changing save file permissions on stop
Posted: Fri May 05, 2017 10:10 am
Hello, first bug post, sorry if duplicate, didn't see anything addressing this issue when I searched for it. I think I found a really obscure error.
System Info
Factorio server version: 0.15.6
OS: ArchLinux 4.10.13-1-ARCH
Description
I seem to have stumbled on a bug where after the Headless server quits it resets the file permissions, owner, and group of the save file. It sets the files permissions to -rw-r--r--, it sets the file owner to be the user who started the server, and it sets the group to be the primary group of the user who started the server.
Tests
- Ran the server manually without my management script and the issue persisted, so it doesn't seem to be an issue with my code
- These permissions appear to also be set for newly generated save files
I realize this will not be an issue for 99% of players as they most likely will only ever run the headless server under one user, but the way I have my server management script setup atm, servers can be run by any user in a group called "factorio". I could change it so that servers are always run under a user name "factorio" regardless of what user run the management script, but I still think the file permissions shouldn't be modified every time you run the server.
Also this issue may have prevented the server from saving the last time I played, as there was about 2 hours worth of changes missing from the map when I restarted the server, despite numerous manual save commands being sent prior to shutdown (that'll teach me to make local backups, that's for sure). Its possible that the issue I've described has nothing to do with the missing map updates, since as far as I recall I ran the server as the same user so it should have been able to write to the save file without issue. However it does seem like quite the coincidence that I notice this permission bug and the missing map updates within the same day. Its also worth noting here that the group the save file is changed to is root, so its possible that the server cant save properly due to this, but it shouldn't since its also setting the permissions to r/w for the user Im running it as and Im not using sudo when I run it. I'll keep looking into the missing map updates issue separately since it may not related to the permissions issues, but my guess is that it is related somehow.
Thanks for reading, I love this game and the devs are f*cking code ninjas!! (5 patches in the first week after a big release, 2 on the same day, and on weekends?!)
System Info
Factorio server version: 0.15.6
OS: ArchLinux 4.10.13-1-ARCH
Description
I seem to have stumbled on a bug where after the Headless server quits it resets the file permissions, owner, and group of the save file. It sets the files permissions to -rw-r--r--, it sets the file owner to be the user who started the server, and it sets the group to be the primary group of the user who started the server.
Tests
- Ran the server manually without my management script and the issue persisted, so it doesn't seem to be an issue with my code
- These permissions appear to also be set for newly generated save files
I realize this will not be an issue for 99% of players as they most likely will only ever run the headless server under one user, but the way I have my server management script setup atm, servers can be run by any user in a group called "factorio". I could change it so that servers are always run under a user name "factorio" regardless of what user run the management script, but I still think the file permissions shouldn't be modified every time you run the server.
Also this issue may have prevented the server from saving the last time I played, as there was about 2 hours worth of changes missing from the map when I restarted the server, despite numerous manual save commands being sent prior to shutdown (that'll teach me to make local backups, that's for sure). Its possible that the issue I've described has nothing to do with the missing map updates, since as far as I recall I ran the server as the same user so it should have been able to write to the save file without issue. However it does seem like quite the coincidence that I notice this permission bug and the missing map updates within the same day. Its also worth noting here that the group the save file is changed to is root, so its possible that the server cant save properly due to this, but it shouldn't since its also setting the permissions to r/w for the user Im running it as and Im not using sudo when I run it. I'll keep looking into the missing map updates issue separately since it may not related to the permissions issues, but my guess is that it is related somehow.
Thanks for reading, I love this game and the devs are f*cking code ninjas!! (5 patches in the first week after a big release, 2 on the same day, and on weekends?!)