MIM 2016: Manage Linux/Unix Identity via Workflows

You can use MIM WAL Powershell workflows

Install PowerShellGet library.

PowerShellGet is an in-box module in the following releases

Get PowerShellGet module for PowerShell versions 3.0 and 4.0

Open Admin PS session

Run import-module SSHSessions to install SSHSessions PowerShell

Running root level commands without interative prompt

By default when you run a SU level command in Linux, you have to enter a password. You have to be first logged into the SU environ and then when you run sudo commands you are again prompted for a password. To bypass the interative prompt, you can echo the password. You can also encrpt the password and decrypt before use. In such a case build your command line in a Powershell variable before executing.

Pre-reqs

  1. Create an Admin user in Linux
  2. Give the user root level rights, or rights to run certain commands, depends on how granular you want to get

Sample SSH script to list all Linux groups

new-sshsession -computername tlkmylinux1 -username tlklnxacct -password Password5

$Results = Invoke-SshCommand -InvokeOnAll -Command ‘echo Password5 | su -c whoami tlklnxacct’

$Results = Invoke-SshCommand -InvokeOnAll -Command ‘echo Password5 | sudo –S getent group’

#Remove ssh session

Remove-SshSession –RemoveAll

Sample SSH script to list add a new user to Linux

new-sshsession -computername tlkmylinux1 -username tlklnxacct -password Password5

$Results = Invoke-SshCommand -InvokeOnAll -Command ‘echo Password5 | su -c whoami tlklnxacct’

$MySamid=”dcrompton”

$Mycommand=”echo Password5 | sudo –S useradd ” + $MySamid

$Results = Invoke-SshCommand -InvokeOnAll -Command $MyCommand

#Remove ssh session

Remove-SshSession -RemoveAll