[nylug-talk] permissions on remote start (hopefully resolved)

R. Mariotti r.mariotti at fdcx.net
Mon Feb 5 13:06:13 EST 2007


NOT one to quit, I kept up with research and trial and error and while I 
may not have come up with the ultimate resolve, I did come up with 
something that "seems" to accomplish what I set out to do.

I've included the command script I created to accomplish this and so 
far... so good.

The MUST DO criteria is that:
1) the user running this command MUST be defined on the remote server;
2) that user MUST have a valid rsa authorized_keys file
3) that user MUST be defined and authorized as a sudo user (if sudo is 
allowed).

Please - if there is a better way to accomplish this, PLEASE advise?

Thanks,

> #!/bin/bash
> #######################################################################
> # rpcstart - remote procedure command start
> #
> # Usage:	rpcstart [-nowait|-wait] [-nosudo] server_name command_name [param_1] [param_2]
> #              *             _______    ______      *            *
> #
> # Created by Robert Mariotti for Sonitrol Communications Corp 2007
> #######################################################################
> # RM - 01/26/2007 Creation
> #
> # Log Invocation
> echo "=========================================">>/var/log/rpcstart.log
> echo "$(date) $0 invoked $*" 					>>/var/log/rpcstart.log
> #######################################################################
> # Intercept & Process wait/nowait option
> case "$1" in
> -nowait)	Wa='nohup'
> 			Wb='\&'
> 			shift
> 			;;
> -wait)		Wa=''
> 			Wb=''
> 			shift
> 			;;
> *)			Wa=''
> 			Wb=''
>       		;;
> esac
> #######################################################################
> # Intercept & Process nosudo option
> case "$1" in
> -nosudo)	Su='sudo'
> 			shift
> 			;;
> *)			Su=''
> 			;;
> esac
> #######################################################################
> # Execute Remote Procedure Call to start specified command
> ssh ${Su} $1 ${Wa} $2 $3 $4 $5 $6 $7 $8 $9 ${Wb}  >>/var/log/rpcstart.log 2>&1



More information about the nylug-talk mailing list