Page 1 of 1

Can I run a chown command on right hand side / sftp ?

Posted: Tue Aug 27, 2024 11:00 am
by Hecate
I'm uploading files from my windows computer to my personal linux server.

After the upload I want to change the user and group from root to nginx.

Can I do that with job > execute command
And put my chown -R nginx:nginx /data/www here ?
Or is the command executed only locally ?

Re: Can I run a chown command on right hand side / sftp ?

Posted: Tue Aug 27, 2024 2:36 pm
by tobias
Hello,
unfortunately it is not possible. Custom commands can only be run using the FTP protocol, not SSH/SFTP.

I will check if it can be added for SFTP. Currently you can only set the permissions, for example 755. This feature is on the Advanced tab sheet of the Internet Protocol Settings dialog.

Here's an example script for FTP, but not all FTP servers support this syntax:

Code: Select all

function OnUploadComplete(const FileName, LocalFilePath, CompleteURL: UnicodeString;
        const isRightSide:Boolean;
        const FileSize:Int64;
        const Connector: Opaque):Boolean;
var CmdRes:Int64;
    ResponseText:UnicodeString;
begin
  CmdRes:=ConnCustomFTPCommand(Connector,'SITE CHMOD 777 '+FileName,200,200,200,ResponseText);
  Log('Set Permissions for '+FileName+': '+ResponseText);
  Result:=true;
  end;
See also
https://www.syncovery.com/pascalscript/