1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Using Sudo from Tomcat web application

Discussion in 'Plesk for Linux - 8.x and Older' started by SirM, Feb 7, 2007.

  1. SirM

    SirM Guest

    0
     
    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
    PHP:
    test
     
  2. SirM

    SirM Guest

    0
     
    Is there anybody who knows something about this ?
     
  3. johnyqqq

    johnyqqq Guest

    0
     
    SirM
    Have you tried NGASI (http://www.ngasi.com).

    NGASI is an addon
    for Plesk and other control panels
    that enables Java Hosting.

    Most importantly each Application Server
    is run by the VHost Domain FTP user
    (the httpdocs owner).

    J
     
  4. SirM

    SirM Guest

    0
     
    Hi Johny,

    Thank you for your reply, the problem is that I can not install anything on the plesk server itself as I am customer of the server and not the owner. Also I am not seeing the owner installing this just for my needs.

    Though I was under the impression that I should be able to do Sudo things with my FTP user name. I mean if I check the user I can see that it exist in the password file.

    "finger <username>" I can see that the user has an uid and a gid.

    Any ideas about this,

    Many thx for your help,

    SirM
     
Loading...