Linux - Security This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
12-10-2003, 04:10 PM
|
#1
|
Member
Registered: Nov 2003
Location: switzerland
Distribution: Fedora Core 1.0/Gentoo
Posts: 35
Rep:
|
boot script execute command as non-root user
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!!
|
|
|
12-10-2003, 04:19 PM
|
#2
|
Member
Registered: Feb 2003
Location: San Antonio
Distribution: Suse 9.0 Professional
Posts: 843
Rep:
|
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.
R.O.
|
|
|
12-10-2003, 05:47 PM
|
#3
|
Member
Registered: Nov 2003
Location: switzerland
Distribution: Fedora Core 1.0/Gentoo
Posts: 35
Original Poster
Rep:
|
then i have to make two scripts: one to start and one with the content. isnt it possible in just one?
|
|
|
12-10-2003, 07:34 PM
|
#4
|
Member
Registered: Feb 2003
Location: San Antonio
Distribution: Suse 9.0 Professional
Posts: 843
Rep:
|
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>
R.O.
|
|
|
12-11-2003, 12:13 PM
|
#5
|
Member
Registered: Dec 2001
Location: Portugal
Distribution: /Red Hat/Fedora/Solaris
Posts: 622
Rep:
|
Howzit
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.
chow
|
|
|
12-11-2003, 12:30 PM
|
#6
|
Member
Registered: Feb 2003
Location: San Antonio
Distribution: Suse 9.0 Professional
Posts: 843
Rep:
|
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.
R.O.
|
|
|
12-11-2003, 01:49 PM
|
#7
|
Member
Registered: Nov 2003
Location: switzerland
Distribution: Fedora Core 1.0/Gentoo
Posts: 35
Original Poster
Rep:
|
exactly, i want to start services on a web server, and there is no login with a bash console
|
|
|
09-24-2004, 05:56 AM
|
#8
|
LQ Newbie
Registered: Sep 2004
Posts: 1
Rep:
|
Pay attention to use su command, it only works if user you specified after it has an enabled shell!
|
|
|
All times are GMT -5. The time now is 04:32 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|