Running UNIX commands as different user, from Java
Trying to write a Java program capable of running a UNIX command as a different UNIX user. I have the user's password, and I know the command I want to run, but the command has to be run as that user - so I have to login as that user first. For example: say we have a user, jim, who wants to see what's in bob's home directory, and (for whatever reason) jim has access to execute ls whereas bob does not. We are currently logged in as bob . Here is what we (could) do: bob@host$ su jim && ls ~bob Problem is, we get prompted for jim's password. Since this is run from a Java program, i.e. Process p =