LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 08-28-2007, 03:57 PM   #1
hraposo
Member
 
Registered: Aug 2004
Posts: 370

Rep: Reputation: 30
Run a scrip as root


I made a script. What I want is when do double click and I say to execute in consoles, that this script run as root… what it does not happen.
What commands I must place at the beginning of script for it run as root?
 
Old 08-28-2007, 04:55 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
If you really need to have unprivileged users run a script with root account rights use Sudo.
 
Old 08-29-2007, 02:50 AM   #3
hraposo
Member
 
Registered: Aug 2004
Posts: 370

Original Poster
Rep: Reputation: 30
What I want is in the script, below:
#!/bin/sh

A line of comand that when I do double click on scrip, opens a console as root an the script runs (as root).
 
Old 08-29-2007, 01:27 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by hraposo View Post
What I want is
Is there something in my reply about Sudo you want me to explain? Or are you talking to yourself?
 
Old 08-29-2007, 01:33 PM   #5
maldojr88
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Rep: Reputation: 0
to get into root user...
type 'su' as regular user....be careful with root priviledges.. you can
harm ur pc

$ su

now once ur in as root
just type ./ before the name of the script..
if the name of the script is "Hello" type as root

# ./Hello

Last edited by maldojr88; 08-29-2007 at 01:35 PM.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
why lftp command run failed when user isn't root, but ok when logining as root steven_yu Linux - Software 0 06-06-2007 08:36 PM
Is a script, run at boot time from init.d, run with root authority? tmbrwolf53 Linux - Server 2 03-31-2007 08:15 PM
Scrip to bootsplash hraposo Debian 3 01-09-2007 06:21 PM
help with scrip tuananhbirm Linux - General 4 02-04-2005 06:30 PM
got a syntax error which shows unexpected end of line when tried to run a shell scrip racer_mec Linux - Newbie 1 01-10-2005 01:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

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