in reply to Implementing Unix sudo command in Perl

Hello rijuroyson,

Your problem statement is vague enough for me not to be able to give you concrete information. :-) Just by going through your question, your problem looks a lot like a job for IPC::ShellCmd and its allied modules. For instance, to implement sudo su $generic_user_id, you can use IPC::ShellCmd::SSH and then you can chain further commands to be executed:

# build your ShellCmd obj - $shellcmd and the command to execute my $shellcmd = IPC::ShellCmd->new($mycommand_to_run); $shellcmd->chain_prog( IPC::ShellCmd::SSH->new( User => 'genericuser', Host => $myhost ) ); $shellcmd->run();
There's even a full example on the module page IPC::ShellCmd.

Hope this helps.