问题
In ubuntu I am logged in as a standard user (with restricted privileges) and I would like to launch a .jar as the admin user, what would be the best way of doing this from the command line?
Many Thanks
回答1:
Use standard tools, i.e. sudo:
sudo java -jar yourjar.jar
As different user:
sudo -u anyuser java -jar yourjar.jar
来源:https://stackoverflow.com/questions/8456285/launch-jar-as-a-different-user