On my (ubuntu) server I have a gameserver running in a screen, owned by user_1. The gameserver has an interactive console to send commands to. Would it somehow be possible to execute a script as user_2 which sends input to user_1's detached screen?


I think this should work:

screen -r user_2 -X stuff "you_script.sh"
screen -r user_2 -X eval "stuff \015"
  • Thanks for your reply, I'm still a bit lost tho.. I'm assuming it should be -r user_1, right? Since user_1 owns the screen. I'm also a bit confused about the 2 lines, are these just 2 examples or does "your_script.sh" gets assigned to 'stuff' which is then send wit the 'eval'? I just did a basic test as user_2: "screen -r user_1 -X echo test" which returns "No screen session found." – iScripters Feb 7 '16 at 14:19
  • Oh, I read this question wrong I apologize. You can use screen -r user_2 -X stuff "commands here" to send the text command here from the current user to user_2. The second line in my answer sends a newline. – cowlicks Feb 8 '16 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.