LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 07-13-2010, 12:22 AM   #1
Arty Ziff
Member
 
Registered: May 2008
Location: Tacoma, WA
Distribution: CentOS and RHEL
Posts: 124

Rep: Reputation: 15
How to add SUDO access?


How do I give a regular user account sudo access?

I'm using CentOSv5 (essentially Red Hat Enterprise 5).

THANKS!
 
Old 07-13-2010, 12:25 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
As "root", edit the /etc/sudoers file. Simple as that

Here's a bit more detail, should you wish to take advantage of other special features:

http://www.centos.org/modules/newbb/...&viewmode=flat

http://aplawrence.com/Basics/sudo.html

Last edited by paulsm4; 07-13-2010 at 12:28 AM.
 
Old 07-13-2010, 01:30 AM   #3
subho.d
Member
 
Registered: Jun 2010
Location: INDIA
Distribution: All Linux & Unix
Posts: 86

Rep: Reputation: 19
Hi ;
Edit this file /etc/sudoers
 
Old 07-13-2010, 01:34 AM   #4
digsecurity
Member
 
Registered: Apr 2010
Posts: 54

Rep: Reputation: 18
echo 'username ALL=(ALL) ALL' >> /etc/sudoers ##As root
 
Old 07-13-2010, 03:58 AM   #5
omersattar
LQ Newbie
 
Registered: Feb 2008
Posts: 14

Rep: Reputation: 1
Use visudo recommended way to edit /etc/sudoers

you should use "visudo" command which is the recommended way to edit /etc/sudoers . Examples are given inside the file so you can easily add users and give them rights to execute some/all commands as root.
Also you can enable log of commands executed via sudo.
 
Old 07-13-2010, 04:08 AM   #6
alli_yas
Member
 
Registered: Apr 2010
Location: Johannesburg
Distribution: Fedora 14, RHEL 5.5, CentOS 5.5, Ubuntu 10.04
Posts: 559

Rep: Reputation: 92
In addition to previous posters; make sure to BACKUP your sudoers file before making changes. Its good practice for any configuration file; and specifically to this one; making a mistake can result in you having to rescue the OS or even worse completely reinstalling.
 
Old 07-13-2010, 07:37 AM   #7
er.surendersharma
Member
 
Registered: May 2010
Posts: 47
Blog Entries: 2

Rep: Reputation: 15
Quote:
Originally Posted by Arty Ziff View Post
How do I give a regular user account sudo access?

I'm using CentOSv5 (essentially Red Hat Enterprise 5).

THANKS!
you should use "visudo" command which is the recommended way to edit /etc/sudoers .
 
Old 07-13-2010, 12:58 PM   #8
RockDoctor
Senior Member
 
Registered: Nov 2003
Location: Minnesota, US
Distribution: Fedora, Ubuntu, Manjaro
Posts: 1,791

Rep: Reputation: 427Reputation: 427Reputation: 427Reputation: 427Reputation: 427
As have mentioned above, use visudo.
 
Old 07-13-2010, 05:27 PM   #9
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Debian
Posts: 6,137

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
The reason for using visudo is that it will check the result of your edit before saving the file, and warn you if you've made a mistake. If you don't like vi, you can ensure visudo uses an editor of your choice by first using the command "EDITOR=nano" (or whatever).
 
Old 07-13-2010, 06:05 PM   #10
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: Washington U.S.
Distribution: M$ Windows / Debian / Ubuntu / DSL / many others
Posts: 2,339

Rep: Reputation: 231Reputation: 231Reputation: 231
change /etc/sudoers but make and verify a backup first.
 
Old 07-15-2010, 12:26 AM   #11
Arty Ziff
Member
 
Registered: May 2008
Location: Tacoma, WA
Distribution: CentOS and RHEL
Posts: 124

Original Poster
Rep: Reputation: 15
I understand the advantages of using something like visudo, but is there any reason why I *should not* simply edit /etc/sudoers:
Quote:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
to look like:
Quote:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
SomeUser ALL=(ALL) ALL
???

Also, when I execute "visudo" at the command line, all that happens is that /etc/sudoers opens in my text editor anyway...

Last edited by Arty Ziff; 07-15-2010 at 12:29 AM.
 
Old 07-15-2010, 01:33 AM   #12
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Read through your /etc/sudoers file and review the pam configuration for su and sudo if any. Also look through your installation manuals Security and Authentication section. E.g.: http://www.redhat.com/docs/en-US/Red...ment_Guide.pdf

It may be configured with both sudoers and pam such that you should add a user to the %wheel group.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sudo Access PMP Linux - Newbie 7 05-04-2009 07:19 AM
[SOLVED] sudo access to few binaries ?? vikas027 Linux - Newbie 7 07-28-2008 07:20 AM
sudo access depam Linux - Newbie 1 02-03-2008 06:56 AM
(Easy Question) add to Sudo nathanhillinbl Linux - Software 3 05-06-2007 10:38 PM
how to add new users in fedora core 4 and allow them to use sudo for some commands y2k6summi Linux - Security 1 03-29-2006 09:38 AM

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

All times are GMT -5. The time now is 05:30 PM.

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