LinuxGSM icon indicating copy to clipboard operation
LinuxGSM copied to clipboard

Permissions

Open JimTR opened this issue 10 years ago • 25 comments

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 ?

JimTR avatar Jun 24 '16 21:06 JimTR

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))

UltimateByte avatar Jun 25 '16 08:06 UltimateByte

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.

dgibbs64 avatar Jun 25 '16 08:06 dgibbs64

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

UltimateByte avatar Jun 25 '16 09:06 UltimateByte

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.

jaredballou avatar Jun 27 '16 19:06 jaredballou

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 ...

JimTR avatar Jun 27 '16 19:06 JimTR

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 :)

UltimateByte avatar Jun 28 '16 10:06 UltimateByte

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?

twinsuns avatar Jul 16 '16 17:07 twinsuns

I will take a look at this for you

dgibbs64 avatar Jul 16 '16 21:07 dgibbs64

@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

dgibbs64 avatar Jul 16 '16 21:07 dgibbs64

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

UltimateByte avatar Aug 27 '16 14:08 UltimateByte

Hello, where I can select to disable checking ownership?

hitmany avatar Oct 10 '16 18:10 hitmany

@hitmany What for ?

UltimateByte avatar Oct 10 '16 22:10 UltimateByte

@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)

hitmany avatar Oct 11 '16 06:10 hitmany

@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.

UltimateByte avatar Oct 11 '16 11:10 UltimateByte

@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 ))))

hitmany avatar Oct 11 '16 11:10 hitmany

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.

UltimateByte avatar Oct 11 '16 12:10 UltimateByte

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

hitmany avatar Oct 11 '16 20:10 hitmany

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

JimTR avatar Oct 11 '16 20:10 JimTR

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

hitmany avatar Oct 11 '16 20:10 hitmany

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

JimTR avatar Oct 11 '16 20:10 JimTR