Make program only run by root | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Make program only run by root

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-13-2008
dave123 dave123 is offline
Registered User
 
Join Date: Dec 2007
Last Activity: 10 June 2009, 3:08 PM EDT
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Make program only run by root

Hi all, i hope i got this in the right place, what i am trying to do is make a program only run by root, ie
for instance user fred is logged in and uses firefox, what id like to do is change that so that when fred wants to use firefox he will be asked to enter root password before he is allowed to use it, is this possible and if so how, if anyone can help could they make it simple as im not very good
at this, i would be most gratefull for any help please.
Sponsored Links
    #2  
Old 02-13-2008
otheus's Avatar
otheus otheus is offline Forum Advisor  
Smartass
 
Join Date: Feb 2007
Last Activity: 23 July 2014, 6:24 AM EDT
Location: Innsbruck, Austria
Posts: 2,151
Thanks: 12
Thanked 48 Times in 45 Posts
1. change the permissions on the executable so that only root can run it. The normal firefox program is actually a script, so make sure you protect all executables in that directory.

2. Set up sudo to allow the user george to run it.

Now, having said that, I highly recommend against giving George your root password. If you want only George to run this program, sudo prompts for his own password. But it's possible to configure George so that he can run the program without a root password.

Having said that, I also highly recommend against giving George the ability to run firefox as root. Instead, specify another (new) user (ie, "firefox-user") that can only run firefox, by changing the ownership of the entire firefox directory to that user. Configure sudo to "run as" that new user.
Sponsored Links
    #3  
Old 02-13-2008
dave123 dave123 is offline
Registered User
 
Join Date: Dec 2007
Last Activity: 10 June 2009, 3:08 PM EDT
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Thankyou for your quick reply but im having problems locating the files to change permissions on, sorry for being a pain but im not to bright at this
i am using gnome, is there a command i can enter in a terminal to do this.
    #4  
Old 02-13-2008
otheus's Avatar
otheus otheus is offline Forum Advisor  
Smartass
 
Join Date: Feb 2007
Last Activity: 23 July 2014, 6:24 AM EDT
Location: Innsbruck, Austria
Posts: 2,151
Thanks: 12
Thanked 48 Times in 45 Posts
Quote:
Originally Posted by dave123 View Post
Thankyou for your quick reply but im having problems locating the files to change permissions on, sorry for being a pain but im not to bright at this
i am using gnome, is there a command i can enter in a terminal to do this.
Try any of the following:

Code:
  which firefox
  whence firefox
  type -a firefox

Do you have a way of preventing the user from installing and running their own firefox?
Sponsored Links
    #5  
Old 02-13-2008
dave123 dave123 is offline
Registered User
 
Join Date: Dec 2007
Last Activity: 10 June 2009, 3:08 PM EDT
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks i have checked that file it is in /usr/bin/firefox but when i right click to check properties it already says root is the owner, i would like firefox to be able to run in that account but only for people with root password if you know what i mean, sorry to be a pain, and thankyou so far for your help.
Sponsored Links
    #6  
Old 02-13-2008
otheus's Avatar
otheus otheus is offline Forum Advisor  
Smartass
 
Join Date: Feb 2007
Last Activity: 23 July 2014, 6:24 AM EDT
Location: Innsbruck, Austria
Posts: 2,151
Thanks: 12
Thanked 48 Times in 45 Posts
Quote:
Originally Posted by dave123 View Post
Thanks i have checked that file it is in /usr/bin/firefox but when i right click to check properties it already says root is the owner, i would like firefox to be able to run in that account but only for people with root password if you know what i mean, sorry to be a pain, and thankyou so far for your help.
So change the permissions so that only root can run it.

chmod og-rx /usr/bin/firefox

But caution, because it's either a softlink or a shell script that points somewhere else. You'll have to follow the chain of events to make sure the actual executable is only runnable by root.
Sponsored Links
    #7  
Old 02-13-2008
dave123 dave123 is offline
Registered User
 
Join Date: Dec 2007
Last Activity: 10 June 2009, 3:08 PM EDT
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Thankyou, you must be getting fed up with me by now, sorry to be a pain
im almost there the command you gave me worked it has ensured firefox can only be run as root, however it would be nice if it asked for root password when you try to use it non root,(at the moment it just says permission denied) like when you try to run a program from the adminstration menu, im probably asking to much here
but thankyou for all your help so far it really has helped alot so far.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Make another set of root(/), /boot, /home and other partitions? yifangt UNIX for Advanced & Expert Users 3 10-30-2011 07:04 PM
I need to make a constant variables to the root ahmedamer12 UNIX for Dummies Questions & Answers 7 04-24-2011 08:48 PM
make a mksysb without root credentials islam.said AIX 2 03-21-2011 02:46 PM
how to make root user read all frankkahle UNIX for Advanced & Expert Users 4 08-30-2007 05:04 PM
cant make dir as root csaunders Solaris 3 08-08-2004 10:26 AM



All times are GMT -4. The time now is 10:25 PM.