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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
09-12-2009, 03:37 PM
|
#1
|
|
Member
Registered: Feb 2007
Posts: 382
Rep:
|
Ubuntu use root without sudo
I have been using Fedora and just got an opportunity to use Ubuntu.
For Fedora, I can just sudo, then can continue working as root without re-sudo.
However, for Ubutuntu, I have to use sudo every time I want to perform task as the root. If the task is short, it will not ask for the password. It becomes problem when I wrote scripts that each task take a long time to complete. The second task will not continue unless I enter the root password again. Is there a way to skip entering the root password?
Here is example of my script:
Code:
# each disk is 1 TB. so it takes a long time to finish.
sudo mkfs -t ext3 /dev/sdb1
sudo mkfs -t ext /dev/sdc1
|
|
|
|
09-12-2009, 03:59 PM
|
#2
|
|
Member
Registered: Jan 2009
Distribution: CentOS 5.3
Posts: 62
Rep:
|
Try using this command,
Sudo passwd passwordhere
then enable the root account to be able to log on from the log on screen,
thats the only thing i could think of> Enabling the root account or making a Database with variables to import the sudo variables after typing it once. (Witch im not sure is even possible)
|
|
|
|
09-12-2009, 04:00 PM
|
#3
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,689
|
if you run sudo -i then you'll get a login session, alternatively just run the entire script as sudo, e.g. "sudo my_admin_script.sh"
|
|
|
|
09-12-2009, 04:00 PM
|
#4
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,689
|
Ugh, no don't do that. Breaking the authentication model really isn't a good move.
|
|
|
|
09-12-2009, 04:49 PM
|
#5
|
|
LQ Newbie
Registered: Sep 2009
Posts: 1
Rep:
|
Just use "sudo -s" to start a shell as root.
|
|
|
|
09-12-2009, 06:33 PM
|
#6
|
|
Senior Member
Registered: Dec 2005
Posts: 1,365
Rep: 
|
if you need to do something as root, then login as root and forget about sudo. this way you do not get lazy and treat Linux like Windows. please remember that Linux is NOT Windows.
|
|
|
|
09-12-2009, 09:04 PM
|
#7
|
|
Member
Registered: Jun 2006
Location: Texas
Distribution: Ubuntu 8.04
Posts: 94
Rep:
|
Quote:
Originally Posted by elisee
Just use "sudo -s" to start a shell as root.
|
its a little safer to use Difference being -i gets you roots environment too. and -s keeps the current environment. - can easily accidentally give root ownership of the users configuration files.
Last edited by louieb; 09-12-2009 at 09:06 PM.
|
|
|
|
09-12-2009, 09:25 PM
|
#8
|
|
Senior Member
Registered: Dec 2008
Location: /root
Distribution: Slackware & BSD
Posts: 1,188
|
ufmale,
Quote:
|
However, for Ubutuntu, I have to use sudo every time I want to perform task as the root.
|
This is the very purpose to minimize running an entire session as root. Unix experience teaches that root account should only be used for essential system works.
Quote:
|
If the task is short, it will not ask for the password.
|
Ubuntu and similar flavors default at 15 minutes, then the sudo root expires, after this short period sudo is again required.
Quote:
|
It becomes problem when I wrote scripts that each task take a long time to complete. The second task will not continue unless I enter the root password again. Is there a way to skip entering the root password?
|
Use gksudo within your script, or if you are sure script is safe run it as being owned by root. Since we do not understand what your script is doing we cannot say any further help other than general concepts.
Hope it helps.
|
|
|
|
09-12-2009, 11:24 PM
|
#9
|
|
Member
Registered: Sep 2009
Posts: 196
Rep:
|
Old School
...
Last edited by Smartpatrol; 03-11-2010 at 09:23 PM.
|
|
|
|
09-12-2009, 11:43 PM
|
#10
|
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 42,689
|
As above though, sudo =i will give a functional equivalent of su - without breaking the ubuntu model.
|
|
|
|
09-13-2009, 03:59 AM
|
#11
|
|
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian Squeeze (server), Slackware 13.37 (netbook), Slackware64 14.0 (desktop),
Posts: 8,357
|
Quote:
Originally Posted by Smartpatrol
Being old school in Ubuntu i sudo to root once and set a root password then su - when i need root(which is the majority of the time). Keep in mind that over the 11 years i have been a Unix/Linux Systems Admin i have conditioned myself to work in the root shell acutely aware of the power of root at all times.
|
Me too. I have a launcher on the panel that runs
Code:
gnome-terminal --window-with-profile=MyRootGTProfile --geometry=1028x768+0+0 -x su -
It is one of the most heavily used panel launchers.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 04:13 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|