LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Screen - Multiuser access + Start as root from other users (https://www.linuxquestions.org/questions/linux-software-2/screen-multiuser-access-start-as-root-from-other-users-879086/)

LexLuthar 05-05-2011 07:01 PM

Screen - Multiuser access + Start as root from other users
 
Hi!

I am trying to figure out how to write a bash script to start a screen session, turn multi-user on, allow about 11 users access to this screen, and then execute a command to startup our game server.
It will need to be run as root (only way to start the game properly), but the script may be executed by a user other than the root account (I also only want the user to be able to run the one line of code to start the server, and not be able to do the other fun things the root account can do)

Any ideas on how I would go about doing this?

Cheers!
-A

gnuweenie 05-07-2011 06:30 AM

You can run something like this to prompt for the root password, and then launch a detached screen session with the command start_game_server executed within:
Code:

gksu -u root 'screen -S gameOn -md start_game_server'&
To turn on multiuser mode, you can either do this in a screenrc config file (before launch), or you can send the command externally this way, after it has been started:

as root:
Code:

screen -X multiuser on
as user who needs to login as root:
Code:

gksu -u root 'screen -X multiuser on'
Root can add users like this:
Code:

screen -X addacl bob
screen -X aclchg bob -w 0
screen -X addacl mindy
screen -X aclchg mindy -w 0
screen -X addacl peter
screen -X aclchg peter -w 0

That should give user visibility to the window, but no obvious way of executing a command as root. The user list can also be configured in the screenrc config file.

LexLuthar 05-08-2011 02:16 AM

Awesome thanks!
So, what would a screenrc config file look like?
I looked at the file, But I was confused as to how to add the specific lines to the file, and how they should be implemented.

Thanks!
-A

gnuweenie 05-09-2011 09:59 AM

Quote:

Originally Posted by LexLuthar (Post 4349791)
Awesome thanks!
So, what would a screenrc config file look like?
I looked at the file, But I was confused as to how to add the specific lines to the file, and how they should be implemented.

Thanks!
-A

You just add the commands to the file as you would type them at the screen command prompt, one command per line. A config file could look like this:
Code:

multiuser on
addacl bob
aclchg bob -w 0
addacl mindy
aclchg mindy -w 0
addacl peter
aclchg peter -w 0



All times are GMT -5. The time now is 02:43 PM.