You are not logged in.

#1 2012-05-19 13:06:18

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,302

[SOLVED] start screen session as different user

This is driving me nuts. I run an opensim server on system, and currently have a watchdog script used to check that the server is running and either run it or re-start it as necessary (in the event of a server crash).

The server itself is run in a gnu screen session so that I can log in to the server remotely via ssh. At the moment I run my watchdog at login, which is not ideal. I want to run it at boot so that I don't actually have to login to start. A prime candidate for rc.local. However, starting the script in rc.local always starts the screen session as root, whatever I do, which is not what I want (obviously a publicly accessible server should not be running as root). Here's what I've tried so far:

in rc.local:

su user -c `sh /home/steve/scripts/checksim.sh` &

in the script:

su user -c 'screen -d -m mono Opensim.exe'

Both tried together and varying combinations. I've also tried with sudo:

sudo -u user -n -i ......

Either the screen session doesn't start, or it starts as root. Any ideas?

Last edited by Roken (2012-05-19 13:28:56)


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus B550-F Gaming MB, 128Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (2 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

/ is the root of all problems.

Offline

#2 2012-05-19 13:28:40

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,302

Re: [SOLVED] start screen session as different user

Argghhh - fixed it.

One of my previous tries resulting in the server running as root had changed ownership of the server cache to root, preventing the server itself starting as a normal user. Fixed up ownership and tried again, now it's running properly from rc.local


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus B550-F Gaming MB, 128Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (2 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

/ is the root of all problems.

Offline

Board footer

Powered by FluxBB