LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
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 09-12-2010, 11:23 AM   #16
crosstalk
Member
 
Registered: Jul 2010
Distribution: Gentoo, Debian, Mint, Xubuntu
Posts: 150

Rep: Reputation: 35

Was that section you posted the full sudoers file?

Can you give me the output of "echo $USER"?

I don't have the best grasp of the sudoers file, but I'll try.

I hope this helps.
 
Old 09-12-2010, 01:04 PM   #17
ubuntuv
Member
 
Registered: Jan 2010
Posts: 67

Original Poster
Rep: Reputation: 0
Sorry about the confusion crosstalk. Here is the full contents of sudoers.

Quote:
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#

Defaults env_reset
Defaults visiblepw

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL) ALL
user ALL=(ALL) NOPASSWD:ALL

# Allow members of group sudo to execute any command after they have
# provided their password
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=(ALL) ALL

#
#includedir /etc/sudoers.d

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
The output of 'echo $USER' is
$ echo $USER
user
 
Old 09-12-2010, 10:29 PM   #18
crosstalk
Member
 
Registered: Jul 2010
Distribution: Gentoo, Debian, Mint, Xubuntu
Posts: 150

Rep: Reputation: 35
I suspect that you are either in the "sudo" group or the "admin" group. You can test this by running the command "groups".

If so, move the line "user ALL=(ALL) NOPASSWD:ALL" to the end of the file (along with a comment to clarify it).

If you are in one of the groups mentioned above, then they would mask this line (sudo always listens to the last line that matches, not the first).

If this doesn't work, then please post the output of "groups" and "sudo -l".

I hope this helps.
 
1 members found this post helpful.
Old 09-12-2010, 11:20 PM   #19
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
The canonical (no ubuntu pun intended) and reasonably safe
way to go about this would be to a) put your user into the
admin group (if he isn't already) and b) make an entry in
sudoers (via visudo) to allow the use of certain (HARMLESS!!)
commands w/o a password ... e.g.:
Code:
%admin ALL=(ALL) ALL NOPASSWD: /sbin/ifconfig
HARMLESS above is, of course, relative. With ifconfig you
can disconnect the machine from the net, with cat you can
clobber the machine ...



Cheers,
Tink
 
Old 09-13-2010, 11:23 AM   #20
ubuntuv
Member
 
Registered: Jan 2010
Posts: 67

Original Poster
Rep: Reputation: 0
Thanks a lot crosstalk.

It worked. I put the line at the end of all lines
user ALL=(ALL) NOPASSWD:ALL

It didnot ask for password at the start of new terminal. It lessened lot of work for me.

-uv
 
Old 09-13-2010, 11:53 AM   #21
ubuntuv
Member
 
Registered: Jan 2010
Posts: 67

Original Poster
Rep: Reputation: 0
Please someone tell me how to say thanks. I could find the help for this anywhere on this website.

-uv
 
Old 09-13-2010, 12:11 PM   #22
djsmiley2k
Member
 
Registered: Feb 2005
Location: Coventry, UK
Distribution: Home: Gentoo x86/amd64, Debian ppc. Work: Ubuntu, SuSe, CentOS
Posts: 343
Blog Entries: 1

Rep: Reputation: 72
By replying you have said thanks

If you'd like to leave a more 'lasting' reminder then on the posts you wish to think people either click the "Yes" to say you found the post helpful, or click the scales by the username and you can also a leave a comment
 
Old 09-13-2010, 12:15 PM   #23
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
Quote:
Originally Posted by ubuntuv View Post
Please someone tell me how to say thanks. I could find the help for this anywhere on this website.

-uv
Use the reputation system!

Click "This post is helpful" to say a post was a bit helpful, or click the scales icon and choose to add reputation in the pop-up menu for very helpful posts.
 
1 members found this post helpful.
Old 09-14-2010, 05:55 AM   #24
ubuntuv
Member
 
Registered: Jan 2010
Posts: 67

Original Poster
Rep: Reputation: 0
Thanks a lot MTK
 
Old 09-14-2010, 07:04 AM   #25
sag47
Senior Member
 
Registered: Sep 2009
Location: Orange County, CA
Distribution: Kubuntu x64, Raspbian, CentOS
Posts: 1,850
Blog Entries: 36

Rep: Reputation: 455Reputation: 455Reputation: 455Reputation: 455Reputation: 455
Hmm the only problem with that is any administrative command can be executed without a password. You should have the following in your sudoers for specifically the command you're using. For instance I run scripts which execute poweroff, reboot, and setpci so I added this line at the end of my sudoers file.
Code:
%admin ALL=NOPASSWD: /sbin/poweroff, /sbin/reboot, /usr/bin/setpci
There can be more than one line with %admin ALL (or any group or user) in the sudoers file. Also my user has to run the commands with the exact path specified in the sudoers file such as "sudo /sbin/poweroff".

If you don't like editing the sudoers file and just want to emulate the root password entry then run the following with your script...
Code:
sudo -S echo Getting root privilages... << EOF
password
EOF
#now you can run consecutive sudo commands without password challenge
or
Code:
sudo -S COMMAND << EOF
password
EOF
View the sudo man page for more information on the -S switch.
SAM

Last edited by sag47; 09-14-2010 at 07:07 AM.
 
Old 09-14-2010, 02:26 PM   #26
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by ubuntuv View Post
Thanks a lot crosstalk.

It worked. I put the line at the end of all lines
user ALL=(ALL) NOPASSWD:ALL

It didnot ask for password at the start of new terminal. It lessened lot of work for me.

-uv

Just for reference I'd like to point out that this
is a bad idea. The extra time it would take you to
type in a password for "dangerous commands" will be
missed at some stage - it always does.



Cheers,
Tink
 
  


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
[SOLVED] Ubuntu recovery mode asks for root password Changes Linux - Newbie 15 10-12-2009 05:48 AM
Install skype on acer one. Asks for root password. don't know where to get this congercod Linux - Newbie 4 02-13-2009 09:08 AM
is possible that sudo always asks the password? Lantius Linux - Software 5 05-09-2007 05:31 PM
SUSE asks for root password at logoff (how do I shut this off?) monkeyboy73 Linux - Desktop 4 12-14-2006 10:28 PM
Redhat 8 asks for root password before dialling head8k Linux - Newbie 9 02-21-2003 05:52 PM

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

All times are GMT -5. The time now is 03: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