Linux - SecurityThis forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
boot script are executed as root user (tell me if i am wrong...).
but i would like to start a process from another user for security reasons. how can i do that? i tried to make a "su www" in the script, but then the console hangs....
thx for help!!
Create the script, stick in /usr/bin,
Make sure the last line of the script contains
exit
then add this to /etc/rc.local
su - <userid> -c <scriptname>
root can change to userid transparently, the -c tells it to execute a command, and the exit in the script will exit the su and the rc.local will continue processing or exit itself. When you su'ed, it did, then was simply waiting for something to do.
No, you append the command to /etc/rc.local
It is a script that is the last to execute regardless of whether you start at runlevel 3 or 5. So, edit the existing /etc/rc.local and add
su - <userid> -c <scriptname>
To the end of it. The only script you need is <scriptname>
u could place the script under the .bashrc which is found in user home dir. Each user has a .bashrc which exec a certain cmds and settings for that user. could place the script in user home dir and under user home dir edit .bashrc file and add path of script in this file donīt forget to add exec perms to script u created with the right ownership.
agoliveira, that would work, but not at boot, only at login. .bashrc is execute at login, not at boot. I think wampfler wants it to start at boot before login, but if not, then .bashrc is a good place to put it.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.