Running a Screen instance of a program as non-root

Posted by user288467 on Ask Ubuntu See other posts from Ask Ubuntu or by user288467
Published on 2014-06-04T18:55:29Z Indexed on 2014/06/05 15:38 UTC
Read the original article Hit count: 255

Filed under:
|
|

I've got a dedicated server (Ubuntu 12.04, no GUI) set up to launch an instance of McMyAdmin and attach it to a screen instance every time I reboot the hardware. I have the command saved to root's crontab as:

@reboot cd /var/MC_SVR && screen -dmS McMyAdmin ./MCMA2_Linux_x86_64

Problem being, though, I have a user set up specifically for FTP access to the server files so I don't always have to SSH into the machine. Since the server is being started as a root process, all the files it makes are, obviously, set with root as the owner.

So I chown'd all the files and set them to ftpuser. Now I'm stuck with trying to get the process to start as ftpuser. I've tried doing the following but to no avail:

cd /var/MC_SVR && su ftpuser - -c 'screen -dmS McMyAdmin ./MCMA2_Linux_x86_64'

I try this in terminal and I get no errors or anything (in fact I never get anything unless it's a syntax error from su), but there's no screen instance to access and so I can assume the server never starts.

So, what am I doing wrong? Or am I just not accessing the screen instance correctly since it's (supposed) to be launched by another user?

© Ask Ubuntu or respective owner

Related posts about screen

Related posts about cron