Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

how to add user to sudoers file?[solved]

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
6 posts • Page 1 of 1
Author
Message
padoor
Advocate
Advocate
User avatar
Posts: 4185
Joined: Fri Dec 30, 2005 1:43 am
Location: india

how to add user to sudoers file?[solved]

  • Quote

Post by padoor » Thu Feb 24, 2011 2:18 am

Code: Select all

ramaswamy@localhost ~ $ sudo
usage: sudo -h | -K | -k | -L | -V
usage: sudo -v [-AknS] [-g groupname|#gid] [-p prompt] [-u user name|#uid]
usage: sudo -l[l] [-AknS] [-g groupname|#gid] [-p prompt] [-U user name] [-u user
            name|#uid] [-g groupname|#gid] [command]
usage: sudo [-AbEHknPS] [-C fd] [-g groupname|#gid] [-p prompt] [-u user name|#uid] [-g
            groupname|#gid] [VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-C fd] [-g groupname|#gid] [-p prompt] [-u user name|#uid] file
            ...
ramaswamy@localhost ~ $ sudoer
-bash: sudoer: command not found
ramaswamy@localhost ~ $ groups
wheel audio cdrom video usb users plugdev portage ramaswamy
ramaswamy@localhost ~ $ sudo gtk-cpuspeedy
Password: 
ramaswamy is not in the sudoers file.  This incident will be reported.
ramaswamy@localhost ~ $ su  
Password: 
localhost ramaswamy # nano -w /etc/sudoers
localhost ramaswamy # 
localhost ramaswamy # cat /etc/sudoers
## sudoers file.
##
## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.
##
## See the sudoers man page for the details on how to write a sudoers file.
##

##
## Host alias specification
##
## Groups of machines. These may include host names (optionally with wildcards),
## IP addresses, network numbers or netgroups.
# Host_Alias	WEBSERVERS = www1, www2, www3

##
## User alias specification
##
## Groups of users.  These may consist of user names, uids, Unix groups,
## or netgroups.
# User_Alias	ADMINS = millert, dowdy, mikef

##
## Cmnd alias specification
##
## Groups of commands.  Often used to group related commands together.
# Cmnd_Alias	PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
# 			    /usr/bin/pkill, /usr/bin/top

##
## Defaults specification
##
## You may wish to keep some of the following environment variables
## when running commands via sudo.
##
## Locale settings
# Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
##
## Run X applications through sudo; HOME is used to find the
## .Xauthority file.  Note that other programs use HOME to find   
## configuration files and this may lead to privilege escalation!
# Defaults env_keep += "HOME"
##
## X11 resource path settings
# Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
##
## Desktop path settings
# Defaults env_keep += "QTDIR KDEDIR"
##
## Allow sudo-run commands to inherit the callers' ConsoleKit session
# Defaults env_keep += "XDG_SESSION_COOKIE"
##
## Uncomment to enable special input methods.  Care should be taken as
## this may allow users to subvert the command being run via sudo.
# Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
##
## Uncomment to enable logging of a command's output, except for
## sudoreplay and reboot.  Use sudoreplay to play back logged sessions.
# Defaults log_output
# Defaults!/usr/bin/sudoreplay !log_output
# Defaults!/usr/local/bin/sudoreplay !log_output
# Defaults!/sbin/reboot !log_output

##
## Runas alias specification
##

##
## User privilege specification
##
root ALL=(ALL) ALL

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL

## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
# %sudo	ALL=(ALL) ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d
localhost ramaswamy # 
i cannot run any command as root using sudo including porthole, emerge, any command for the example
how can i overcome this limitation
i always get same error
Last edited by padoor on Thu Feb 24, 2011 2:32 am, edited 1 time in total.
reach out a little bit more to catch it (DON'T BELIEVE the advocate part under my user name)
Top
mikegpitt
Advocate
Advocate
User avatar
Posts: 3224
Joined: Sat May 22, 2004 6:49 pm

  • Quote

Post by mikegpitt » Thu Feb 24, 2011 2:24 am

This part is the key:

Code: Select all

## Uncomment to allow members of group wheel to execute any command 
# %wheel ALL=(ALL) ALL 
Uncomment that line and add your user to the wheel group. Although your comment puzzles me a bit, since root doesn't need sudo to execute commands with privilege. You also will only want to run things like emerge as root. I'm not sure if there would be bad consequences if you ran emerges as a regular user with sudo.
Top
dol-sen
Retired Dev
Retired Dev
User avatar
Posts: 2805
Joined: Sun Jun 30, 2002 2:44 pm
Location: Richmond, BC, Canada

  • Quote

Post by dol-sen » Thu Feb 24, 2011 2:25 am

you can edit the sudoers file. The best way is to use the command visudo as root in a terminal.

move down and uncomment teh ones you want enabled. I uncommented only the first one, so I need to use my user password when prompted to run a command via sudo.

This is the relevant section of mine.

Code: Select all

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL

## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
# %sudo ALL=(ALL) ALL
Brian
Porthole, the Portage GUI frontend irc@freenode: #gentoo-guis, #porthole, Blog
layman, gentoolkit, CoreBuilder, esearch...
Top
padoor
Advocate
Advocate
User avatar
Posts: 4185
Joined: Fri Dec 30, 2005 1:43 am
Location: india

  • Quote

Post by padoor » Thu Feb 24, 2011 2:31 am

ok i edited the file with visudo
and now it seems to be working ok
thanks for a fast response :)
reach out a little bit more to catch it (DON'T BELIEVE the advocate part under my user name)
Top
Logomachist
n00b
n00b
Posts: 37
Joined: Mon Jun 02, 2014 3:58 am
Location: PA, USA

Where do you get visudo?

  • Quote

Post by Logomachist » Tue Nov 04, 2014 2:02 am

dol-sen wrote:you can edit the sudoers file. The best way is to use the command visudo as root in a terminal.
Where do you get visudo? It doesn't seem to be in portage or any of the overlays.
Top
kurly
Apprentice
Apprentice
Posts: 260
Joined: Mon Apr 02, 2012 4:47 pm

Re: Where do you get visudo?

  • Quote

Post by kurly » Tue Nov 04, 2014 2:09 am

Logomachist wrote:
dol-sen wrote:you can edit the sudoers file. The best way is to use the command visudo as root in a terminal.
Where do you get visudo? It doesn't seem to be in portage or any of the overlays.
FYI, you are replying to a post that is over 3.5 years old. That said, visudo is at /usr/sbin/visudo if you have app-admin/sudo installed.
Top
Post Reply

6 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic