LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-28-2009, 02:58 AM   #1
narendra1310
Member
 
Registered: May 2008
Posts: 41

Rep: Reputation: 15
Question How to change a process running in root-user to non-root user ????????????????????


Hi

Is It possible to change a process running in root-user to non-root-user by setting suid / uid / euid / gid etc...

I so please instruct how, when and wat to set in order to change a process running in root-user to non-root user ?

Thanks in Advance
 
Old 10-28-2009, 03:09 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you can't *change* the owner, but you can start it running as whoever you want during a boot up. If there is no automatic handling of this via the program itself (many programs will pull levers internally to become unpriviledged users once they no longer needs roots powers) then you can run a command via su, e.g. "su -l myotheruser -c runthiscommand" in your /etc/rc.local script for example.
 
Old 10-28-2009, 04:20 AM   #3
narendra1310
Member
 
Registered: May 2008
Posts: 41

Original Poster
Rep: Reputation: 15
My daemon is in "/etc/init.d/"

For verfication purpose
I run your command "su -l myotheruser -c runthiscommand". manually as a root-user shown below.

[root@lin4 storage]# su -l test -c "chroot /home/test/builds/server/schroot /apache/bin/httpd -k start"

I faced this error
chroot: cannot change root directory to /home/test/builds/server/schroot: Operation not permitted

wheather I need to run the command as a non-root user ????

for your reference
ls -l /home/test/builds/server/
drwxrwxrwx 12 test test 4096 2009-10-27 20:34 schroot





Quote:
Originally Posted by acid_kewpie View Post
you can't *change* the owner, but you can start it running as whoever you want during a boot up. If there is no automatic handling of this via the program itself (many programs will pull levers internally to become unpriviledged users once they no longer needs roots powers) then you can run a command via su, e.g. "su -l myotheruser -c runthiscommand" in your /etc/rc.local script for example.
 
Old 10-28-2009, 04:27 AM   #4
narendra1310
Member
 
Registered: May 2008
Posts: 41

Original Poster
Rep: Reputation: 15
if i run directly chroot as a root-user, then it is working
as shown below

[root@lin4 storage]# chroot /home/test/builds/server/schroot /apache/bin/httpd -k start


For your reference
[root@lin4 Storage]# ps aux |grep httpd
root 28251 0.8 0.3 17072 6744 ? Ss 14:58 0:00 /apache/bin/httpd -k start
 
Old 10-29-2009, 02:11 AM   #5
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Well apache is really not a good example for using this, esp wil chroot. httpd will normally run as a different user, e.g. web or httpd or nobody, so there's no need to externally fudge something like this, in the same way there are proper ways to chroot it too.
http://www.securityfocus.com/infocus/1694
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run daemon process being a normal user [not root user]. narendra1310 Linux - Software 1 10-26-2009 09:48 AM
IPC fails between user process and root process zaryab Linux - Newbie 1 09-22-2008 01:25 AM
Start a program for a user as root, with process belonging to user gnashley Programming 4 03-19-2007 01:58 PM
Help! Cannot Add a User to User Manager or Change Root Password lennysokol Linux - General 2 06-25-2005 09:59 AM
Boot process as non-root user fatman Debian 6 06-07-2005 04:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration