Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to invoke a program to run as another user (by getting input user/pwd) in AS400 OS using Java. Like runas in Windows or sudo in Unix — what can we do in AS400 OS?

I am able to invoke basic Unix commands like find, cd, ls etc. through Java on AS400.

I have very restricted access on the experimental AS400 sandbox provided to me. So I am not sure if sudo command through java will work when ran as admin.

I think on AS400 console STRQSH or QSH is a custom build program and all Unix commands are not supported. Hence I am clueless about what is the correct and concert way of doing it. Any guidance will be appreciated – how do the industry folks do it? Is there any sudo/runas equivalent in AS400? Do IBM have its own shell?

share|improve this question

migrated from Aug 1 '12 at 23:06

This question came from our site for computer enthusiasts and power users.

The security model on the AS400/iSeries is significantly different from Windows and Unix/Linux. You should probably spend a little time studying it before attempting to do much with security interfaces. – Hot Licks Aug 1 '12 at 16:19
Ask for a user profile that has the authorisation you need. – Buck Calabro Aug 1 '12 at 16:24

Take a look at the QSYGETPH api ... this will let you switch to a user profile that you have authority to.

share|improve this answer
I wanted some solution such that I don't leave the java code. After QSYGETPH(invoke through java) we need to perform jobs with the same handle, so I cannot invoke a executable file sitting on IBM OS through java as a fresh user even after QSYGETPH api authentication is successful :( – AkD Aug 1 '12 at 17:23
I don't have access to QSYGETPH but it will be great to know if we can authenticate and execute a program as a single unit. You can authenticate & execute a executable as a single unit in window or unix through java using runas/sudo (using java runtime call). How can we achieve that in IBM OS. Any strategies? – AkD Aug 1 '12 at 17:38
Are you trying to switch credentials in the middle of a process ... or invoke a command using different credentials from within your Java code? – david Aug 1 '12 at 18:14
invoke a command using different credentials from within your Java code. – AkD Aug 1 '12 at 18:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.