Link to home
Start Free TrialLog in
Avatar of Jason Yu
Jason YuFlag for United States of America

asked on

How can I make a command only be ran by sudo permission

I have a maven server. My boss requires me to set up this "mvn" command be run by sudo. I have added the path to the command to the user's profile and can run it every this user's permission. but when I tried to run the same command with "sudo" before it. it doesn't work.

How could I make "sudo mvn" work?


[kkondi@trialserverc1 ~]$ mvn -version
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T13:51:42+00:00)
Maven home: /usr/local/apache-maven/apache-maven-3.2.2
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-0.b14.10.amzn1.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.14-24.50.amzn1.x86_64", arch: "amd64", family: "unix"
[kkondi@trialserverc1 ~]$ sudo mvn -version
sudo: mvn: command not found
[kkondi@trialserverc1 ~]$


my boss says below:

"if mvn is in path then..
I should be able to do sudo mvn too..
but i am not able to do it right now"

is it true with what he said?

All experts here, please kindly give a good reason to defend my point if his saying is wrong.

Thanks.
SOLUTION
Avatar of Mazdajai
Mazdajai
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jason Yu

ASKER

Ok, I will try to add it now.
how you added mvn to sudo?
Omarfarid:


I don't know how to do it, but my boss asked me to do it.

Do you have any clue?

thanks.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
great, I will follow you experts advise to read the soduer manual and test this setup.

I am happy to get the solution here, have a nice weekend, all guys here.

Thanks.
great help, the advises are valuable.