SCP task takes ownership of file and doesn't preserve group write bit

XMLWordPrintable

    • 0
    • 1

      Problem Definition

      The SCP task takes over ownership of the file, therefore locking everyone else out except for the service account that SCPs the file.

      If a file is created without the group write bit set, it will result in permission issues. So ideally, we'd like the ability to configure the SCP task to do something similar to:

      chmod g+w <file>
      scp <file>
      

      Even if a Script task is created before the SCP that performs the chmod on the file, the SCP task does not preserve the group write bit which doesn't match the behavior of (this does preserve it):

      chmod g+w target/test.jar 
      sshpass -p "password" scp target/test.jar user@host:/home/user
      

      Suggested Solution

      If possible, preserve permissions at destination of SCP task

      Workaround(s)

      1. Create a Command Task
      2. Add rsync as an executable
      3. Example argument: -avz --rsh=ssh --chmod g+w ./ <user>@<destinationhost>:/<target>/<dir>
      4. This will copy the entire contents of the working directory to the remote server and set the group write bit in the same operation.
      5. You will also need to setup your SSH keypair between the hosts.
        or
      1. Add a script task to chmod the file first
      2. Add a Command Task with SCP executable. You will still need the script task to chmod it.
        or
      1. Use an SSH task after the SCP to SSH in and chmod the files at destination

       

            Assignee:
            Unassigned
            Reporter:
            Jeremy Owen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: