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

General Discussion in English
Post Reply
Hecate
Posts: 9
Joined: Tue Apr 09, 2024 12:27 pm

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

Post 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 ?
tobias
Posts: 1936
Joined: Tue Mar 31, 2020 7:37 pm

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

Post 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/
Post Reply