abbreviations in sudo

Jim Chivas j_chivas at langara.bc.ca
Mon Jun 2 12:29:44 EDT 2003


Greetings:

1. Is it possible to use a small sudo command (alias) to be expanded into
the correct command?

ex:

I want the sudo user to enter 'sudo addu bob' which in turn will run the
sudo command:

useradd -g staffer -k skel1 -s /usr/bin/ksh

and add bob to the end of the expanded command resulting in:


useradd -g staffer -k skel1 -s /usr/bin/ksh bob




2. Is it possible to use substitution in sudo?

ex:

I want the sudo user to enter 'sudo addu skel2 bob' which in turn will run
the command: useradd -g staffer -k X -s /usr/bin/ksh Y

Thus both X and Y will be replaced with a value off the sudo command
entered by the sudo user.

useradd -g staffer -k skel2 -s /usr/bin/ksh bob

Or do both of the above examples have to be fully expanded by using a
alias or script at the OS system level prior to sudo seeing them?

Thanks

Jim




More information about the sudo-users mailing list