I need to execute the given commands as root and sudo user using Java. However, I am not sure about the method that I can use to pass the password. Is there a way by which I can pass the password to the terminal ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You could just drop sodu all together and create a shell script suid root and run that instead.
whenever that script is called it will be run as root.