LinuxQuestions.org
Help answer threads with 0 replies.
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 06-22-2013, 02:18 AM   #16
info.latawaz
Member
 
Registered: Jun 2013
Location: India
Posts: 44

Original Poster
Rep: Reputation: Disabled
Post


Finally figured it out.

Here are the steps in a bottleneck to help a fellow in need.
1) Edit /etc/sudoers with visudo and add this line.
Code:
<your-user> ALL=(ALL) <commands-you-want(with path) or ALL(for all commands)>
2) Type sudo to check if it is installed. If not, then install it.(http://linuxg.net/how-to-install-and...-slackware-14/)
3) Once installed, open /etc/profile, look for PATH and add ':/sbin' at the end before double quotes or other path if the command is in another folder and save.
4) Logout
5) Login back with the user and try 'sudo <your-command>. It should work now.

Last edited by info.latawaz; 06-22-2013 at 02:20 AM.
 
Old 06-27-2013, 11:45 AM   #17
vineethsp
LQ Newbie
 
Registered: Mar 2013
Location: India
Distribution: RedHat Enterprise Linux Server Edition 5.5
Posts: 13

Rep: Reputation: Disabled
Quote:
Originally Posted by info.latawaz View Post
I made changes in sudoers and this is what I did
Code:
myuser ALL=(ALL) /sbin/halt,/sbin/poweroff,/sbin/shutdown
I then executed 'sudo poweroff' and got 'Command not found'. I then executed 'sudo /sbin/poweroff' and it worked.

Now the only thing that is left is to remove /sbin, as in to use 'sudo poweroff'. I think adding path /sbin to $PATH should work. Right? If so, how and where do I add path?
Hi,

You can export the path as
Code:
export PATH=/sbin:$PATH
/sbin is the new path you would like to add while
$PATH has the existing paths you need to retain in the new path.

Hope this is Helpful.
CheeerrZZZZ
 
Old 06-27-2013, 02:15 PM   #18
info.latawaz
Member
 
Registered: Jun 2013
Location: India
Posts: 44

Original Poster
Rep: Reputation: Disabled
I tried export but the path it had added was removed when I restarted the system. However, editing directly in the file worked.

This problem has been solved. Thanks for the input though. Much Appreciated.
 
Old 06-28-2013, 05:59 AM   #19
linuxzilla.com
LQ Newbie
 
Registered: May 2013
Distribution: CentOS, Ubuntu, Debian
Posts: 22

Rep: Reputation: Disabled
Quote:
Originally Posted by jdkaye View Post
Have you edited the sudoers file (usually /etc/sudoers). You need to add a line like this:
Before:
Code:
# User privilege specification
root    ALL=(ALL:ALL) ALL
After:
Code:
# User privilege specification
root    ALL=(ALL:ALL) ALL
myuser  ALL=(ALL:ALL) ALL
Or something like that.
jdk
That is the correct answer and I use to do that for a sudo user. After that for logging in, use the following command to get into root:

sudo su -

and give myuser password again!
 
Old 06-28-2013, 08:53 PM   #20
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by info.latawaz View Post
I tried export but the path it had added was removed when I restarted the system. However, editing directly in the file worked.

This problem has been solved. Thanks for the input though. Much Appreciated.
Environment variable settings are unique to that terminal and its child processes. If you want a change to the environment variable to be applied to all future terminals then you need to add it to your .bashrc or .bash_profile file.
 
Old 07-02-2013, 12:22 PM   #21
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by linuxzilla.com View Post
That is the correct answer and
No it isn't and chrism01 already posted how sane folks should use Sudo (http://www.linuxquestions.org/questi...#post4975941):
Quote:
Originally Posted by chrism01
Never use the keyword ALL if you can avoid it; always be specific.
 
  


Reply

Tags
su, sudo, sudoers



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
expect command ssh sudo error linuxguru1 Linux - General 7 05-07-2013 04:40 PM
Error while running the command : sudo apxs -i -c mod_lisp2.c barun mukhopadhyay Linux - Server 14 03-14-2013 07:21 AM
sudo cd /root gives 'sudo: cd: command not found'. stf92 Linux - Newbie 4 03-03-2012 09:05 AM
b43 firmware installed , still only works after sudo modprobe b43 command issued modo505 Linux - Wireless Networking 4 07-31-2011 08:18 PM
[SOLVED] sudo: umount works, mount not works sasser Slackware 3 07-09-2010 03:01 AM

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

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