Linux RunAs uid/gid

http://blog.teksol.info/pages/daemontools/tutorial

http://thedjbway.b0llix.net/daemontools/uidgid.html

http://manpages.ubuntu.com/manpages/precise/man8/setuidgid.8.html

Your environment variables will contain passwords, and you don’t want those files to be world-readable. Set your environment’s directory permissions to 0700, and the individual files to 0600. Then, ensure you always setuidgid last in your run scripts.

sudo apt-get install daemontools

### vi touch1.sh ============================

#!/bin/sh
exec 2>&1

exec setuidgid www-data touch /mnt/nfs/fs-01.sdb1/www.data1.log

### vi touch2.sh ============================

#!/bin/sh
exec 2>&1

exec setuidgid www-data sh -c 'echo "hello world" > /mnt/nfs/fs-01.sdb1/www.data2.log'

### vi touch3.sh ============================

#!/bin/sh
exec 2>&1

sh ./touch1.sh
sh ./touch2.sh

How-to-run-a-Java-Application-from-Bash-Script


Tag Cloud