Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8181141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:25:21+00:00 2026-06-07T00:25:21+00:00

Given that the web application doesn’t have su privileges, I’d like to execute a

  • 0

Given that the web application doesn’t have su privileges, I’d like to execute a shell script that requires sudo. I’d also like to avoid having the user input the password. What are my options? This is basically what I’m trying to do.

Wicket Application (Form for changing the IP)

@Override
protected void onSubmit() {
    System.out.println("Submitted");            
    try {
        Shell.updateIp("eth0", "192.168.217.129");
    } catch (IOException e) {
        e.printStackTrace();
    }
}

Shell.java

public static void updateIp(String ethernetInterface, String ip) throws IOException {
    ProcessBuilder builder = new ProcessBuilder("/home/keeboi/Desktop/iptool.sh", ethernetInterface, ip);
    Process child = builder.start();
    Network.readOutput(child);
    child.destroy();
}

iptool.sh executes a runnable jar.

iptool.sh

#!/bin/sh
sudo java -jar changeip.jar $1 $2

And I’m getting:

sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: 3 incorrect password attempts

Again, I’d like to emphasize that the web app isn’t given any su privileges and I’d like to avoid asking the user for password.

Edit:

I’ve already tried adding keeboi ALL = NOPASSWD: /home/keeboi/Desktop/iptool.sh to my /etc/sudoers but it still requires a password.

Update

Added keeboi ALL = NOPASSWD: /home/keeboi/Desktop/changeip.jar too, no dice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:25:23+00:00Added an answer on June 7, 2026 at 12:25 am

    just add NOPASSWD in /etc/sudoers:

    user     ALL = NOPASSWD: /home/keeboi/Desktop/iptool.sh
    

    That switches password check off.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application that shows a users all of their data bucketed
I have a web application that creates directories. The application works fine when creating
I have a Java Web application that has several servlets with the following mappings.
I have a Visual Studio 2010 MVC2 web application that I'm building via the
I have built an ASP.NET MVC 3 web application (with exlusively Razor/cshtml pages) that
I have an iPhone web application that creates a meta viewport tag dynamically, using
In a C#/ASP.NET application, I have a form that renders much like the following
I have a web application that uses a couple of PDF forms to create
I have web application in that I have a ajaxTabedinterface. I want open the
I have a Java web application that uses CometD. The workflow is simple: I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.