DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Administering REXEC

Adding a service

To make a service on your machine available to remote users through REXEC, you add the service to the REXEC database using the rxservice command.

The syntax of the rxservice command, when used to add a service, is as follows:

rxservice -a servicename [-d description] [-u] servicedef

See rxservice(1Mbnu) for an explanation of the options accepted by the rxservice command.

The REXEC facility defines the following macros, which can be used by any service. When you specify any of the following macros, REXEC substitutes appropriate values for the macros when a remote user makes a request for the service. The remote user is not required to enter the information as arguments to the invoking command.


%m
The address of the client machine.

%t
The name of the transport provider used to connect to the server.

%s
The mapped user's shell, obtained from the /etc/passwd file on the server.
If the value of a macro cannot be obtained, the macro is expanded to a dash (-).

Examples

Assume you want to define the shutdown command so that it can be used remotely. The syntax of shutdown is as follows:

shutdown [-y] [-g grace_period] [-i init_state]

Let's call the remote shutdown service rshutdown. If you want rshutdown to support all the parameters to shutdown and in the same way (as options), then you would define rshutdown as follows:

rxservice -a rshutdown -d "rshutdown usage: rshutdown \
shutdown_options" 'cd/;/sbin/shutdown %*'

The macro %* means that rshutdown supports all options to shutdown. Suppose you were to define the rshutdown service as follows:

rxservice -a rshutdown -d "rshutdown usage: rshutdown \
minutes initstate" 'cd/;/sbin/shutdown -g%1 -i%2'

When defined this way, the macros indicate that the -g and -i operands (that is, values for %1 and %2, respectively) are required. If the remote user fails to supply a grace period operand or an init state operand, the rshutdown command will fail. Note that the service definition omits the -y option. Because the option has been omitted in the service definition, the rshutdown user cannot by-pass the prompt that asks him or her to confirm that the system should be shut down.

The following command line defines a service called rlookup, which accesses a local database via a command called dblook:

rxservice -a rlookup -d 'Remote database lookup' \
'/usr/bin/dblook %*'

The following command line defines a service called rsetup, which modifies database tables via a local command called setdb. The setdb command takes the address of the client machine as a parameter.

rxservice -a rsetup -d 'remote setup service' \
'/usr/bin/setdb %m'


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 22 April 2004