Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 05-06-2005, 02:56 AM   #1
Registered: Jun 2003
Location: Austin, Texas
Distribution: Fedora Core 8, 32-bit
Posts: 126

Rep: Reputation: 15
Question executing a program as root


I have fedora core 3 on my desktop. like everyone, i usually work on a normal user accounf, and login as root only when needed.
how do i create a script that performs tasks which only the superuser can? i mean, without the intermediate "enter password" prompt?
for example, i create a link on the desktop, that executes the command "poweroff" on the desktop when i click on it. but can i fix it so that it doesnt ask for the root password? something like allowing the particular command to be run by a normal user?
i hope i cud get my point accross.

thanx in anticipation,
Old 05-06-2005, 03:01 AM   #2
Registered: Jul 2004
Location: Canberra
Distribution: Mint 7
Posts: 204

Rep: Reputation: 30
The program you are looking for is called sudo or sudoers it allows you to specify which users can do root stuff with or without password control
Old 05-06-2005, 12:48 PM   #3
Registered: Sep 2003
Location: Bulgaria
Distribution: Ubuntu 9.10, FreeBSD 7.2
Posts: 459

Rep: Reputation: 31
The other thing you could do is to set SUID root flag on the script. You log in as root and do: chmod +s /path/to/script. After that whoever runs the script it works with root rights. It can do the work, and it is easy to be done, if that is what you need. If you work on a single-user desktop machine, you doesn't have to worry about security holes :P


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Executing program as non-root arip Programming 4 12-01-2005 05:41 AM
Writing and executing a program Russb Linux - Software 1 07-25-2004 06:49 PM
executing a program in new terminal? kashifbilal Programming 7 04-26-2004 04:52 AM
Servlets executing a C program. webee Programming 1 02-04-2003 05:19 PM
Executing a program with out system() in c++ sobdk Programming 2 11-02-2002 07:45 AM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:43 AM.

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