LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-22-2010, 06:12 PM   #1
bbb125
LQ Newbie
 
Registered: Aug 2010
Posts: 17

Rep: Reputation: 1
running shell scripts that require root priv. in ubuntu


hi all,

I know that there is no root user defined in ubuntu, so you have to prefix your commands with sudo. But what if I want to run a shell script which executes commands that require root privledges?

For example, I am trying to run a configure script:

sudo ./configure

But it cannot do what it needs to do:

mkdir: cannot create directory `/lib/modules/0.0.0': Permission denied
 
Old 08-22-2010, 06:22 PM   #2
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,977
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Quote:
Originally Posted by bbb125 View Post
hi all,

I know that there is no root user defined in ubuntu, so you have to prefix your commands with sudo. But what if I want to run a shell script which executes commands that require root privledges?

For example, I am trying to run a configure script:

sudo ./configure

But it cannot do what it needs to do:

mkdir: cannot create directory `/lib/modules/0.0.0': Permission denied
try
Code:
sudo su -
 
Old 08-22-2010, 11:52 PM   #3
vinaytp
Member
 
Registered: Apr 2009
Location: Bengaluru, India
Distribution: RHEL 5.4, 6.0, Ubuntu 10.04
Posts: 704

Rep: Reputation: 55
This Will take you to the root prompt.
Code:
sudo bash
 
Old 08-23-2010, 02:20 AM   #4
iam_techno
Member
 
Registered: Aug 2006
Location: Oregon
Distribution: Ubuntu 9.04, Windows 7
Posts: 48

Rep: Reputation: 16
bbb125,

I might add that when you are done with using "sudo su", in the console use "exit" to get back to your normal user.

iamtechno
 
Old 08-23-2010, 03:19 AM   #5
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,544

Rep: Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898Reputation: 2898
I have a question on why a configure script is asking to make changes elsewhere on your system????
If it was make install I would have understood.
 
Old 08-23-2010, 03:51 AM   #6
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
You run a root shell if you issue sudo -i. You can also do:
sudo bash -c "command(s) here".
 
  


Reply


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
I need help running my shell scripts as root jahobjafwar Linux - Newbie 14 08-23-2010 03:33 PM
How to execute shell commands that require root password from PHP ? newbie_0404 Linux - Software 2 06-27-2010 08:16 AM
Running shell scripts, commands need root/su, how? digity Linux - Newbie 5 01-07-2010 05:19 AM
is suid disabled from running all scripts or just from running them as root monsteriname Programming 2 09-05-2009 02:57 AM
running shell scripts salparadise Linux - Newbie 2 12-21-2002 05:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:57 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration