Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-17887

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

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • None
    • SCP and SSH tasks
    • None
    • 0
    • 1
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      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

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            jowen@atlassian.com Jeremy Owen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: