So I have a Windows SFTP server (SFTPSERVER), which receives files (duh).
I then need to push those files to a Linux server (AD authenticated to my domain) elsewhere in my organzation.
So that bit I have down.
rsync -vzO --remove-source-files -e "ssh -i /cygdrive/c/cygwin/home/transferuser/privatekey.pri" /cygdrive/d/SFTPPATH/SFTPUSER/* [email protected]:/path/to/files
The problem is I then get files on the linux server owned by transferuser. They need to be owned by processuser and processgroup on the destination server. Because these files arrive irregularly and need to be copied upon completion of upload, a cronjob from the destination server is not viable for me. I've tried scripting a chown, but the user pushing the files (transferuser) doesn't seem to have the relevant permissions. Given that I don't want to give this account sudo rights on the destination server, what options do I have here?
chown
is a root-only command. You could give rights to a specific command line --/bin/chown faculty *
for example, and the only additional permission is to change ownership to just that one new owner.