[GH-ISSUE #899] Permissions #719

Closed
opened 2026-02-27 02:03:20 +03:00 by kerem · 25 comments
Owner

Originally created by @JimTR on GitHub (Jun 24, 2016).
Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/899

I am perhaps trying to do something the script is not capable of :-
on reflection of the fastdl module I setup a standard apache install on Ubuntu
added a folder to var/www/html via a user other than the default www-data and installed the game server there ... so the path is /var/www/html/gmod and the user is gamer with a group of gamer all works ok until you actually try to run the script as www-data (apache user) ... the script returns

`Current script owner: gamer
current user is www-data
we are going to do st
Please Wait starting server
[ FAIL ] Starting gmod-server: Oops ! Ownership issue...

  • Current - www-data - user or its group(s) - www-data gamer hv test - does not own "gmodserver"
  • To check the owner and allowed groups, run ls -l "gmodserver"`

as you can see the script indicates an ownership issue even though the executing user belongs to the script owner group (in this case user 'www-data' is in the group 'gamer') should this user be able to run the script as the user belongs to a valid group or does the script only run as the respective user and the error message should not show or imply that only a group is required to run the script ?

Originally created by @JimTR on GitHub (Jun 24, 2016). Original GitHub issue: https://github.com/GameServerManagers/LinuxGSM/issues/899 I am perhaps trying to do something the script is not capable of :- on reflection of the fastdl module I setup a standard apache install on Ubuntu added a folder to var/www/html via a user other than the default www-data and installed the game server there ... so the path is /var/www/html/gmod and the user is gamer with a group of gamer all works ok until you actually try to run the script as www-data (apache user) ... the script returns `Current script owner: gamer current user is **www-data** we are going to do st Please Wait starting server [ FAIL ] Starting gmod-server: Oops ! Ownership issue... - Current - www-data - user or its group(s) - www-data **gamer** hv test - does not own "gmodserver" - To check the owner and allowed groups, run ls -l "gmodserver"` as you can see the script indicates an ownership issue even though the executing user belongs to the script owner group (in this case user 'www-data' is in the group 'gamer') should this user be able to run the script as the user belongs to a valid group or does the script only run as the respective user and the error message should not show or imply that only a group is required to run the script ?
kerem 2026-02-27 02:03:20 +03:00
Author
Owner

@UltimateByte commented on GitHub (Jun 25, 2016):

For now, the script wants the user to be the owner as this is how the script is intended to be used in the first place. Maybe that rule should be more relaxed for more fancy uses. :o))

<!-- gh-comment-id:228524268 --> @UltimateByte commented on GitHub (Jun 25, 2016): For now, the script wants the user to be the owner as this is how the script is intended to be used in the first place. Maybe that rule should be more relaxed for more fancy uses. :o))
Author
Owner

@dgibbs64 commented on GitHub (Jun 25, 2016):

I need to review this code as teh function doesnt fully comply with how I want the permissions checker to be. @UltimateByte dont worry its a decent function. Im just very fussy.

<!-- gh-comment-id:228524879 --> @dgibbs64 commented on GitHub (Jun 25, 2016): I need to review this code as teh function doesnt fully comply with how I want the permissions checker to be. @UltimateByte dont worry its a decent function. Im just very fussy.
Author
Owner

@UltimateByte commented on GitHub (Jun 25, 2016):

@dgibbs64 I don't feel offended, it for sure can be improved. ^^

<!-- gh-comment-id:228526189 --> @UltimateByte commented on GitHub (Jun 25, 2016): @dgibbs64 I don't feel offended, it for sure can be improved. ^^
Author
Owner

@jaredballou commented on GitHub (Jun 27, 2016):

The way I handle this on my managed servers is as such:

  • Create a shared FastDL location for my game servers, like /opt/fastdl
  • Set the permissions via ACL so that game server manager can write
  • Run sync script to move non-standard maps to this location, and symlink each file back to ~/serverfiles/$GAME/maps/
  • Have an Apache conf.d snippet that creates an alias and sets permissions for users to read and download those files, with indexes.

This way I don't have to do any weird things like give gameserver users www-data group access, or deal with duplicate files. I also don't need to give www-data any permissions to my game server users' files, which is my biggest concern. The primary use of these servers is games, so I worry more about a compromised Apache screwing up game servers than game servers screwing up Apache.

<!-- gh-comment-id:228847722 --> @jaredballou commented on GitHub (Jun 27, 2016): The way I handle this on my managed servers is as such: - Create a shared FastDL location for my game servers, like /opt/fastdl - Set the permissions via ACL so that game server manager can write - Run sync script to move non-standard maps to this location, and symlink each file back to ~/serverfiles/$GAME/maps/ - Have an Apache conf.d snippet that creates an alias and sets permissions for users to read and download those files, with indexes. This way I don't have to do any weird things like give gameserver users www-data group access, or deal with duplicate files. I also don't need to give www-data any permissions to my game server users' files, which is my biggest concern. The primary use of these servers is games, so I worry more about a compromised Apache screwing up game servers than game servers screwing up Apache.
Author
Owner

@JimTR commented on GitHub (Jun 27, 2016):

The issue here was the script indicated that the user group should be valid to run the script but it does not .. I am pointing out most game server installers don't want to mess about :- install & work thats all they want ...

<!-- gh-comment-id:228857247 --> @JimTR commented on GitHub (Jun 27, 2016): The issue here was the script indicated that the user group should be valid to run the script but it does not .. I am pointing out most game server installers don't want to mess about :- install & work thats all they want ...
Author
Owner

@UltimateByte commented on GitHub (Jun 28, 2016):

The function is here
https://github.com/dgibbs64/linuxgsm/blob/master/lgsm/functions/check_permissions.sh
Feel free to pull request something that would solve your issue and keep it working in the current LGSM :)

<!-- gh-comment-id:229011826 --> @UltimateByte commented on GitHub (Jun 28, 2016): The function is here https://github.com/dgibbs64/linuxgsm/blob/master/lgsm/functions/check_permissions.sh Feel free to pull request something that would solve your issue and keep it working in the current LGSM :)
Author
Owner

@twinsuns commented on GitHub (Jul 16, 2016):

I have a similar problem and now can't start my server. I run a web control panel on my box and it auto adds the folders 'conf' and 'mail' to the home dir of every user it creates. These folders have root ownership which I can't change and therefore the server fails to start.

Is there a way we can add files and folders to be excluded from the permissions check?

<!-- gh-comment-id:233142590 --> @twinsuns commented on GitHub (Jul 16, 2016): I have a similar problem and now can't start my server. I run a web control panel on my box and it auto adds the folders 'conf' and 'mail' to the home dir of every user it creates. These folders have root ownership which I can't change and therefore the server fails to start. Is there a way we can add files and folders to be excluded from the permissions check?
Author
Owner

@dgibbs64 commented on GitHub (Jul 16, 2016):

I will take a look at this for you

<!-- gh-comment-id:233152286 --> @dgibbs64 commented on GitHub (Jul 16, 2016): I will take a look at this for you
Author
Owner

@dgibbs64 commented on GitHub (Jul 16, 2016):

@twinsuns please create a new issue as this is not related to your problem also update your functions. I have just make a change that should resolve your issue

<!-- gh-comment-id:233152368 --> @dgibbs64 commented on GitHub (Jul 16, 2016): @twinsuns please create a new issue as this is not related to your problem also update your functions. I have just make a change that should resolve your issue
Author
Owner

@UltimateByte commented on GitHub (Aug 27, 2016):

This should be solved now, as there is now a selective permission check.
Re-open if needed, but i don't think so. :)

<!-- gh-comment-id:242921611 --> @UltimateByte commented on GitHub (Aug 27, 2016): This should be solved now, as there is now a selective permission check. Re-open if needed, but i don't think so. :)
Author
Owner

@hitmany commented on GitHub (Oct 10, 2016):

Hello, where I can select to disable checking ownership?

<!-- gh-comment-id:252701905 --> @hitmany commented on GitHub (Oct 10, 2016): Hello, where I can select to disable checking ownership?
Author
Owner

@UltimateByte commented on GitHub (Oct 10, 2016):

@hitmany What for ?

<!-- gh-comment-id:252760426 --> @UltimateByte commented on GitHub (Oct 10, 2016): @hitmany What for ?
Author
Owner

@hitmany commented on GitHub (Oct 11, 2016):

@UltimateByte Its frustrating me))) srly, I have a lot of servers in 1 dedic server(each game server using different user) and when I uploading new files to game server directory I cant start/stop/watch console - all commands throws ownership error
Hate it)

<!-- gh-comment-id:252822401 --> @hitmany commented on GitHub (Oct 11, 2016): @UltimateByte Its frustrating me))) srly, I have a lot of servers in 1 dedic server(each game server using different user) and when I uploading new files to game server directory I cant start/stop/watch console - all commands throws ownership error Hate it)
Author
Owner

@UltimateByte commented on GitHub (Oct 11, 2016):

@hitmany this is not a valid reason, learn how to manage your files properly

https://github.com/GameServerManagers/LinuxGSM/wiki/File-Ownership
https://github.com/GameServerManagers/LinuxGSM/wiki/FTP-SCP

Don't use ftp, use sftp, and more than anything else, use it as the user you're working on not as root, ever. Don't do that ever again. If you need to edit root files use ssh as anyone rational. That said, use ssh to edit files rather than an sftp, use sftp only to upload files.

<!-- gh-comment-id:252892811 --> @UltimateByte commented on GitHub (Oct 11, 2016): @hitmany this is not a valid reason, learn how to manage your files properly https://github.com/GameServerManagers/LinuxGSM/wiki/File-Ownership https://github.com/GameServerManagers/LinuxGSM/wiki/FTP-SCP Don't use ftp, use sftp, and more than anything else, use it as the user you're working on not as root, ever. Don't do that ever again. If you need to edit root files use ssh as anyone rational. That said, use ssh to edit files rather than an sftp, use sftp only to upload files.
Author
Owner

@hitmany commented on GitHub (Oct 11, 2016):

@UltimateByte I am using SFTP only, but for each server I must use different users
For example:
I have 5 servers on LGSM, each server has own user(user1,user2,user3,user4)
I must update servers extension in one time, what I must do to prevent your ownership errors:

  1. login as user1 and upload extensions to server1
  2. reconnect WinSCP and login as user2 and upload extensions to server2
    ))))
<!-- gh-comment-id:252896165 --> @hitmany commented on GitHub (Oct 11, 2016): @UltimateByte I am using SFTP only, but for each server I must use different users For example: I have 5 servers on LGSM, each server has own user(user1,user2,user3,user4) I must update servers extension in one time, what I must do to prevent your ownership errors: 1) login as user1 and upload extensions to server1 2) reconnect WinSCP and login as user2 and upload extensions to server2 ))))
Author
Owner

@UltimateByte commented on GitHub (Oct 11, 2016):

I use filezilla and save users credentials, problem solved. Filezilla supports sftp.
Otherwise it try to download and edit from the user directly with su - user then nano, wget, unzip, cp, mv... Problem solved again.

<!-- gh-comment-id:252906034 --> @UltimateByte commented on GitHub (Oct 11, 2016): I use filezilla and save users credentials, problem solved. Filezilla supports sftp. Otherwise it try to download and edit from the user directly with su - user then nano, wget, unzip, cp, mv... Problem solved again.
Author
Owner

@hitmany commented on GitHub (Oct 11, 2016):

@UltimateByte okay if you wont to add this feature its not problem

<!-- gh-comment-id:253028524 --> @hitmany commented on GitHub (Oct 11, 2016): @UltimateByte okay if you wont to add this feature its not problem
Author
Owner

@JimTR commented on GitHub (Oct 11, 2016):

I totally understand
I have 5 servers on LGSM, each server has own user(user1,user2,user3,user4)
I must update servers extension in one time, what I must do to prevent your ownership errors:

  1. login as user1 and upload extensions to server1
  2. reconnect WinSCP and login as user2 and upload extensions to server2
    I really don't see why this is not possible
<!-- gh-comment-id:253031951 --> @JimTR commented on GitHub (Oct 11, 2016): I totally understand I have 5 servers on LGSM, each server has own user(user1,user2,user3,user4) I must update servers extension in one time, what I must do to prevent your ownership errors: 1) login as user1 and upload extensions to server1 2) reconnect WinSCP and login as user2 and upload extensions to server2 I really don't see why this is not possible
Author
Owner

@hitmany commented on GitHub (Oct 11, 2016):

Guys I am not forcing you to do a new feature if its difficult to add a few lines of code
Thank you for great LGSM

<!-- gh-comment-id:253033263 --> @hitmany commented on GitHub (Oct 11, 2016): Guys I am not forcing you to do a new feature if its difficult to add a few lines of code Thank you for great LGSM
Author
Owner

@JimTR commented on GitHub (Oct 11, 2016):

I have nothing to do with the project .. I just interjected that your issue is valid and should be addressed

<!-- gh-comment-id:253033748 --> @JimTR commented on GitHub (Oct 11, 2016): I have nothing to do with the project .. I just interjected that your issue is valid and should be addressed
Author
Owner

@dgibbs64 commented on GitHub (Oct 11, 2016):

@hitmany You can use one username if you like. As long as its not a root user. something like /home/csgoserver/server1``/home/csgoserver/server2

<!-- gh-comment-id:253036063 --> @dgibbs64 commented on GitHub (Oct 11, 2016): @hitmany You can use one username if you like. As long as its not a root user. something like `/home/csgoserver/server1``/home/csgoserver/server2`
Author
Owner

@JimTR commented on GitHub (Oct 11, 2016):

@dgibbs64 read: -
I must update servers extension in one time, what I must do to prevent your ownership errors:
I guess the OP is using pooled data to use across servers in order to conserve disk space which I guess is the smart way to go if you are running multiple servers of the same type perhaps there should be a data 'pool' for multiple servers (symlinks) rather than just multiple installs of the same files

<!-- gh-comment-id:253076625 --> @JimTR commented on GitHub (Oct 11, 2016): @dgibbs64 read: - I must update servers extension in one time, what I must do to prevent your ownership errors: I guess the OP is using pooled data to use across servers in order to conserve disk space which I guess is the smart way to go if you are running multiple servers of the same type perhaps there should be a data 'pool' for multiple servers (symlinks) rather than just multiple installs of the same files
Author
Owner

@cedarlug commented on GitHub (Oct 12, 2016):

Why not use rsync? It's the tool made for this purpose. Set up ssh key access for root on one server to have key-based (without-password setting in sshd.conf) access to your other servers (the default in Debian now).

Then:

rsync -larv -e "ssh -i ~/.ssh/gameserver-key" --usermap=gameserver1:gameserver2 --groupmap=gameserver1:gameserver2 --chmod=a+rwx,g+rwx,o-wrx /home/gameserver1/ root@server2.com:/home/gameserver2/

This also works to move files between server deployments on the same system - just skip the -e flag and omit the "root@server2.com:" prefix.

The usermap changes gameserver1-owned files to gameserver2-ownership on the target. The chmod option above represents 770 permission to be set on the target.

Edit: Needed the trailing slash on the source directory. Fixed Grammar-o.

<!-- gh-comment-id:253087569 --> @cedarlug commented on GitHub (Oct 12, 2016): Why not use rsync? It's the tool made for this purpose. Set up ssh key access for root on one server to have key-based (`without-password` setting in sshd.conf) access to your other servers (the default in Debian now). Then: ``` bash rsync -larv -e "ssh -i ~/.ssh/gameserver-key" --usermap=gameserver1:gameserver2 --groupmap=gameserver1:gameserver2 --chmod=a+rwx,g+rwx,o-wrx /home/gameserver1/ root@server2.com:/home/gameserver2/ ``` This also works to move files between server deployments on the same system - just skip the -e flag and omit the "root@server2.com:" prefix. The usermap changes gameserver1-owned files to gameserver2-ownership on the target. The chmod option above represents 770 permission to be set on the target. Edit: Needed the trailing slash on the source directory. Fixed Grammar-o.
Author
Owner

@UltimateByte commented on GitHub (Oct 12, 2016):

What we could do, is disable ownership checks on symlinked files in serverfiles, if it's not already the case.

However, disabling ownership checks would not discourage inexperienced users from bad practices, which is the main reason why we added this in the first place. Remember that wrong ownerships on logs can prevent log rotation, wrong ownerships on functions can prevent lgsm updates, wrong ownerships on server files can prevent server update or server backup... Many people underestimate those consequences of a bad ownership, and some people would even try to solve it with chmod 777... For all these reasons, i suggest not allowing the user to turn off ownership detection with an option because lazy people and newbies would then come back with their ownership issues, and i think we got better things to do than support this kind of stuff if the script can do kinda auto support.

The only thing that would need to be solved is the case of wrong positives, such as symlinks.

So my question is : does LGSM cause a positive ownership alert if a symlink of a file from another user is found ?

Ultimately, if you have addons to update and they are in a zip format, and you can overwrite any file from it, then you can use something like my simple zip updater and cronjob it instead.
https://github.com/UltimateByte/zip-updater
You can even add a /home/gameserver/gameserver fu at the end of it to do the server update right after, or better, stop the server before zip updating functions, then update, then start.

<!-- gh-comment-id:253103388 --> @UltimateByte commented on GitHub (Oct 12, 2016): What we could do, is disable ownership checks on symlinked files in serverfiles, if it's not already the case. However, disabling ownership checks would not discourage inexperienced users from bad practices, which is the main reason why we added this in the first place. Remember that wrong ownerships on logs can prevent log rotation, wrong ownerships on functions can prevent lgsm updates, wrong ownerships on server files can prevent server update or server backup... Many people underestimate those consequences of a bad ownership, and some people would even try to solve it with chmod 777... For all these reasons, i suggest not allowing the user to turn off ownership detection with an option because lazy people and newbies would then come back with their ownership issues, and i think we got better things to do than support this kind of stuff if the script can do kinda auto support. The only thing that would need to be solved is the case of wrong positives, such as symlinks. So my question is : does LGSM cause a positive ownership alert if a symlink of a file from another user is found ? Ultimately, if you have addons to update and they are in a zip format, and you can overwrite any file from it, then you can use something like my simple zip updater and cronjob it instead. https://github.com/UltimateByte/zip-updater You can even add a `/home/gameserver/gameserver fu` at the end of it to do the server update right after, or better, stop the server before zip updating functions, then update, then start.
Author
Owner

@lock[bot] commented on GitHub (Jul 19, 2018):

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

<!-- gh-comment-id:406154636 --> @lock[bot] commented on GitHub (Jul 19, 2018): This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Sign in to join this conversation.
No labels
Atomic
Epic
cannot reproduce
command: backup
command: console
command: debug
command: details
command: fast-dl
command: install
command: mods
command: monitor
command: post-details
command: restart
command: send
command: start
command: stop
command: update
command: update-lgsm
command: validate
command: wipe
distro: AlmaLinux
distro: Arch Linux
distro: CentOS
distro: Debian
distro: Fedora
distro: RedHat
distro: Rocky Linux
distro: Ubuntu
distro: openSUSE
engine: goldsrc
engine: source
game: 7 Days to Die
game: ARMA 3
game: Ark: Survival Evolved
game: Assetto Corsa
game: Avorion
game: BATTALION: Legacy
game: Barotrauma
game: Battalion 1944
game: Battlefield 1942
game: Black Mesa: Deathmatch
game: Blade Symphony
game: Call of Duty 2
game: Call of Duty 4
game: Call of Duty: United Offensive
game: Counter-Strike 1.6
game: Counter-Strike 2
game: Counter-Strike: Global Offensive
game: Counter-Strike: Source
game: Day of Infamy
game: Dayz
game: Death Match Classic
game: Don't Starve Together
game: ET: Legacy
game: Eco
game: Factorio
game: Factorio
game: Garry's Mod
game: Half-Life
game: Hurtword
game: Insurgecy
game: Insurgecy
game: Insurgency: Sandstorm
game: Just Cause 3
game: Killing Floor
game: Killing Floor 2
game: Left 4 Dead 2
game: Minecraft
game: Minecraft Bedrock
game: Mordhau
game: Multi Theft Auto
game: Mumble
game: Natural Selection 2
game: No More Room in Hell
game: Pavlov VR
game: Post Scriptum
game: Project Zomboid
game: Quake 3
game: QuakeWorld
game: Red Orchestra: Ostfront 41-45
game: Return to Castle Wolfenstein
game: Rising World
game: Rust
game: San Andreas Multiplayer
game: Satisfactory
game: Soldat
game: Soldier of Fortune 2
game: Squad
game: Squad 44
game: Starbound
game: Stationeers
game: Sven Co-op
game: Team Fortress 2
game: Teamspeak 3
game: Teeworlds
game: Terraria
game: The Front
game: Unreal Tournament 2004
game: Unreal Tournament 3
game: Unreal Tournament 99
game: Unturned
game: Valheim
game: Wurm Unlimited
game: Zombie Master Reborn
game: label missing
good first issue
help wanted
info: alerts
info: dependency
info: docker
info: docs
info: email
info: query
info: steamcmd
info: systemd
info: tmux
info: website
info: website
needs more info
outcome: duplicate
outcome: issue resolved
outcome: issue resolved
outcome: issue unresolved
outcome: pr accepted
outcome: pr rejected
outcome: unconfirmed
outcome: wontfix
outcome: wrong forum
potential-duplicate
priority
pull-request
type: bug
type: feature
type: feature
type: feature request
type: game server request
type: refactor
waiting response
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/LinuxGSM#719
No description provided.