• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Running Java Program as a specific user.

 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

I have to run a utility on Ubuntu but that utility can be run only under a specific user group.I am using the ProcessBuilder class to run that utility but I don't know how to run the Java program (or the thread) under that specific user

Example: the utility dbmaint (Pervasive SQL) can be run only if you are under the user group "psql".

I would like to run dbmaint from my java program as a psql user. Any pointers code snippets would be really helpful

Thanks in advance.

Kind Regards.
Hasnain.
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Obviously there's nothing in the Java classes for that. So:

  • Figure out how to run the program as a specific user in your preferred shell
  • Run that shell command via ProcessBuilder
  •  
    Consider Paul's rocket mass heater.
    reply
      Bookmark Topic Watch Topic
    • New Topic