Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Switching users for client/server applications?

 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm wondering about this problem. If you have a server process running, which you launched under your admin or root account, and a client application executes code on the server, say a system call, the server process will execute that system call as the admin or root instead of the user of the client application.
Is it possible to switch users or run the above mentioned system call as the user who is running the client application?
Thanks for any ideas. I'm still searching the groups and web for this information. This seems to be a common problem, so there must be a worked out solution already.
Thank you.
 
author and iconoclast
Posts: 24203
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is not something that you can do in pure Java. To do this in C, you'd either have to start a sub-process to handle each client request, or you'd have to have a single-threaded server that switched EUIDs for each client. In Java, the first alternative is certainly open to you; you'd need to fork the children through a small "glue" program wihch would do the the seteuid() call, then start the JVM.
As far as the second alternative: I'm not sure if this would work or not, but you could certainly try it: write a native method wrapper for seteuid(), and then make sure you only handled client requests on a single thread.
 
Brian Joseph
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your suggestions, Ernest.
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic