rush and SuSE Linux - work around scripts to fix prompt of \h:\w$

  • 7004288
  • 24-Aug-2009
  • 26-Apr-2012

Environment

Novell Privileged User Manager 2.2
SuSE Linux Enterprise Server 11
SuSE Linux Enterprise Server 10

Situation

With Novell Privileged User Manager installed and configured on SuSE Linux,  running the command  "usrun rush" will bring the user to a  prompt looking like the following:

\h:\w$

Instead of a typical bash prompt of  bberger@nts154:~>   OR   nts154:~ # 

Resolution

The following two scripts will allow you to have a more helpful user prompt by configuring the PS1 variable.


1.  Add the "Modify Environment" Script to your rush rule.

The "Modify Environment" Script is included in the Samples Scripts
(Command Control | Import Samples | Sample Perl Scripts | Select "Modify Environment" | Finish)

After adding the script to your "rush" rule, you'll need to select the "rush" rule, then "Script Arguments"

Select Add | and add the following:

Name: setenv
Value: ENV=/dev/null

Select Add |

Name: setenv
Value: BASH_ENV=/dev/null

Select Add |

Select Finish.
Name: setenv
Value: PS1=[${Exec.runAs}$@${Exec.runHost}$]#


2 . Create a new script called "modify PS1" and added the following to the "Script" section of this script.  Add this script to the Rush rule.

$meta->child("Job")->arg("job_login",1);
$meta->child("Job")->arg("job_doprofile",0);
return(1);


The Pseudocode for my basic "Rush" rule looks like the following:

Begin Rule: Rush
If ((user IN Rush Users) AND (command IN Rush))
Then
        Set Authorise: yes
        Set runUser = "root"
        Run Script: Modify Environment(setenv:ENV=/dev/null, setenv:BASH_ENV=/dev/null, setenv:PS1=[${Exec.runAs}$@${Exec.runHost}$]#)
        Run Script: Modify PS1(setenv:ENV=/dev/null, setenv:BASH_ENV=/dev/null, setenv:PS1=[${Exec.runAs}$@${Exec.runHost}$]#)
        Stop
End If
End Rule: Rush