Looking for a remote "chown" command ?
I written a small shell script which uses scp (and a public key) to put a file from my main server onto 6 other remote servers. Works OK but the file on the remote servers end up belonging to root. Is there a command I could use to chown the file on all 6 remote servers to another user in one action ? Or is there something other than scp which would retain original ownership settings ?
Mike - getting there, slowly but surely :-)
Here's my little script...
## Script to put a file onto ALL Training Centre Servers from PTServer
TCSERVERS="172.16.172.21 172.16.86.7 172.16.15.7 172.16.132.44 172.16.63.7 172.16.158.7 172.16.50.7 172.16.145.5"
if [ $# -ne 2 ] ; then
echo "Error. Usage: putfile.sh source file, destination directory" >&2; exit 1
elif [ -z $2 ] ; then
echo "Error. No destination given" >&2; exit 1
for server in $TCSERVERS ; do
scp $1 $server:$2/$(basename $1) > /dev/null
echo "Copying $(basename $1) to $server:$2/$(basename $1)"