Reputation: 547
I have root access in my terminal and I am trying to run a command as another user with sudo privileges and I can't make it work.
Here is the scenario:
I am logged in as root and I want to execute sudo echo hello world
as the user javier
.
I currently have sudo -u javier sudo echo hello world
but it prompts for a password.
Is there a way of running this without it prompting for a password?
Upvotes: 0
Views: 8975
Reputation: 1
I think you need: sudo -u javier -i echo "hello world"
Or try sudo -u javier -i ls -al
So that root runs the command in user context.
Upvotes: 0
Reputation: 21965
If you're a sudoer
, then you could edit the /etc/sudoers
file for the user javier
using vim :
sudo vi /etc/sudoers
and add something like :
javier ALL=(ALL) NOPASSWD:ALL
Save the file and then execute your command. You should be good to go.
Upvotes: 2