• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

Using sudo through Java application loaded in tomcat

S

SirM

Guest
Hi All,

I have written a java web application that gets loaded in the Tomcat server. This server runs with the credentials of the tomcat user.

I would like my Web App to be able to manipulate my apache httpdocs directory. I could do this by setting the directory's permission to 777 in Plesk. Though that would mean that anybody who has an application running in the Tomcat server would be able to manipulate this directory. Next to that it would mean that all the files in the httpdocs that are created newly, would be owned by the tomcat user, this is not desired because if you FTP you will gets permission issues.

I found after many test that the best way to do this is by calling the sudo command and then do the desired actions. This because I have the credentials to manipulate the httpdocs directory for my website.

The problem is, when I invoke .exec("sudo -u <username> <command>"), no matter what I do in my program it will continually say that the password that I provide for the user is incorrect. Note that I have tested and made sure the user does exist, i.e. I can log in on FTP and I have seen the user in the passwd file. Next to that, if i do "finger <username>" I can see that the user has an uid and a gid

Are you able to tell me what is still going wrong.

Many thx for any help,

SirM
 
Back
Top