5

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?

Mark Henderson
  • 68,316
  • 31
  • 175
  • 255
AkD
  • 161
  • 3
  • 1
    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. –  Aug 01 '12 at 16:19
  • 1
    Ask for a user profile that has the authorisation you need. – Buck Calabro Aug 01 '12 at 16:24

1 Answers1

2

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

David G
  • 205
  • 1
  • 11
  • 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 01 '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 01 '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 G Aug 01 '12 at 18:14
  • invoke a command using different credentials from within your Java code. – AkD Aug 01 '12 at 18:36