Run Module as User

Discussion in 'Plugins/Modules/Addons' started by rythmCorrect, Jun 8, 2017.

  1. rythmCorrect

    rythmCorrect New Member

    Hello,
    I have added a plugin as an interface module to ISPConfig(at `/usr/local/ispconfig/interface/web/`). My application has to create some directories inside `/var/www/client1/web1/web`. The problem is `/var/www/client1/web1/web` is owned by web1:client1 where as my application is running as the user ispconfig:ispconfig. It results in permission denied error. I have to run my app as an interface module of ispconfig. Is there any way in which I can run this module as currently logged in user?
     
  2. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    I suspect you would create a server plugin, not an interface plugin, and it would be run as root. (caveat: I have no actual experience here, just guessing)
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    What Jesse told you is the way to go.
     
  4. rythmCorrect

    rythmCorrect New Member

    Thanks for the replay.
    Is there documentations available for creating ispconfig server plugin?
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    There is no further documentation available. Do you want to run an action when e.g. a website or mail user or mail domain is added or do you want to run a completely custom action on a database table that you added yourself in the ISPConfig database?
     
  6. rythmCorrect

    rythmCorrect New Member

    My application installs php scripts(like wordpress) at user site directory(/var/www/client1/web1/web). But I cant do that because my app runs as the user ispconfig and throws permissions error. Is there any way to run the plugin as the web user(e.g. web1:client1)?
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    create a new server plugin in server/plugins-available and enable it with a symlink in plugins-enabled folder, your plugin name must be after Apache and Nginx in alphabet so it runs when the website has been created. Your plugin must bind itself to the website insert and update events like the apache and ngnx plugins are doing it. The best is that you look at the apache and nginx plugins to get an idea how this works. server plugins run as root, so you can access the websites and chown the data to the right user.
     

Share This Page