PDA

View Full Version : [SOLVED] How to execute a command in terminal without root's password?



catman
10th November 2014, 05:17 AM
I read manual about sudoers. There are these lines:
By default, sudo requires that a user authenticate him or herself
before running a command. This behavior can be modified via the
NOPASSWD tag. Like a Runas_Spec, the NOPASSWD tag sets a default for
the commands that follow it in the Cmnd_Spec_List. Conversely, the
PASSWD tag can be used to reverse things. For example:

ray rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm

would allow the user ray to run /bin/kill, /bin/ls, and /usr/bin/lprm
as root on the machine rushmore without authenticating himself.

I have wrote in /etc/sudoers the line:

pushistiq pushistiq = NOPASSWD: /usr/sbin/pm-suspend
but...it does nothing. When I enter "pm-suspend", it returns me:

This utility may only be run by the root user.
What am I doing wrong? :confused:

P.S. I am on Fedora 21 (GNOME).

hrsetrdr
10th November 2014, 05:52 AM
I read manual about sudoers. There are these lines:
I have wrote in /etc/sudoers the line:

pushistiq pushistiq = NOPASSWD: /usr/sbin/pm-suspend
but...it does nothing. When I enter "pm-suspend", it returns me:


This utility may only be run by the root user.

What am I doing wrong? :confused:

P.S. I am on Fedora 21 (GNOME).


Did you su to root to enter "pm-suspend"?

catman
10th November 2014, 05:59 AM
Did you su to root to enter "pm-suspend"?
No. It was my mistake. I needed to enter "sudo pm-suspend". Thank you!