Posts Tagged ‘surprise’

screen -d Fix “Must run suid root for multiuser support.” su user detach error

Thursday, March 28th, 2013

I had to run a shell script to run automatically in detached screen during Linux system boot up via /etc/rc.local. This is needed because the server uses the tiny shell script to fetch data from remote host database and fill information into local MySQL server.

My idea was to su from root to www-data (Apache) user – the script has requirements to run with Apache user, then it has to run detached using GNU screen (multi terminal emulator. The tiny one line script I imagined would do the trick is like so:

# tty=$(tty); su www-data -c 'cd /home/user/www/enetpulse; screen -d /home/user/www/enetpulse/while_true.sh'; chmod 0720 $tty

I run this as root user to test whether it will work or not before I put it in /etc/rc.local but for my surprise got an error:
 

Must run suid root for multiuser support.

After a quick investigation on what is causing it I came across the solution which is to include screen arguments (-m -S shared). The working variant that gets around the error – i.e. successfully changes user privileges to Debian Apache user (www-data) and then detach with screen is:

# tty=$(tty); chmod a+rw $tty; su www-data -c 'cd /home/user/www/enetpulse; screen -d -m -S shared /home/user/www/enetpulse/while_true.sh'; chmod 0720 $tty;

That's all now script works out as planned on next server reboot

A wonderful surprise

Tuesday, November 6th, 2007

I was surprised when a friend of mine has mentioned a nice things concerning me in IRC,his alias is Order you can read what he has written about me in Bulgarian here:http://will.sleep.at/home/index.php?/archives/2-Blagodarstveno.html . Everything good mentioned about me in the post how I have contributed to himhow thankful he is to me and stuff is the same with me towards him.So Order Old buddy It’s a real blessing to know you. And I’m dumb too,you know “PROSTE SME!!” :)) Big thanks to the man Order (Ivo) vizantiecfor being with me in a hard times and helping me go on ( he knows what I’m talking about ).Ivo I owe you a lot. This post meaned a lot to me. BTW Nice picture on the Blog! Emblematicas usual.Also don’t forget to check Ivo’s blog located at http://will.sleep.at ;]Die by the fork :]END—–