is_user

Package: WA2L/edrc 1.5.57
Section: Library Commands (3)
Updated: 12 July 2021
Index Return to Main Contents

 

NAME

is_user - check if command is started by a certain user

 

SYNOPSIS

edrc/lib/is_user [ -h ]

is_user [ -n ][ -s scriptname ] -u user_list

is_user [ -s scriptname ] -u user_list

 

AVAILABILITY

WA2L/edrc

 

DESCRIPTION

evaluate if the user that started the command matches to one username specified by the -u option. This command is used to limit a script execution to supported users only.

 

OPTIONS

-h
print usage message.

-n
no message output, if the username of the user starting the command where the is_user command is running is not listed in the user_list.

-s scriptname
scriptname to print in the message output. In a script this setting is normally set to $0.

-u user_list
comma separated list of usernames that are allowed to run the command.

 

ENVIRONMENT

-

 

EXIT STATUS

0
User is in user-list list.

2
User is not in user-list (command start not permitted).

4
usage printed.

 

FILES

-

 

EXAMPLES

1) check if user is fred or barney
        is_user -s $0 -u fred,barney || exit $?

2) check if user is root or admin*:
        is_user -s $0 -u root,admin* || exit $?

 

SEE ALSO

edrcintro(1), id(1), is_osid(3)

 

NOTES

-

 

BUGS

-

 

AUTHOR

is_user was developed by Christian Walther. Send suggestions and bug reports to wa2l@users.sourceforge.net . 

 

COPYRIGHT

Copyright © 2021 Christian Walther

This is free software; see edrc/doc/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


 

Index

NAME
SYNOPSIS
AVAILABILITY
DESCRIPTION
OPTIONS
ENVIRONMENT
EXIT STATUS
FILES
EXAMPLES
SEE ALSO
NOTES
BUGS
AUTHOR
COPYRIGHT

This document was created by man2html using the manual pages.
Time: 16:53:18 GMT, August 28, 2024