Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sftp_only and delete_remote_files not working together #54

Open
SimonIT opened this issue Jul 1, 2023 · 3 comments
Open

sftp_only and delete_remote_files not working together #54

SimonIT opened this issue Jul 1, 2023 · 3 comments

Comments

@SimonIT
Copy link

SimonIT commented Jul 1, 2023

No description provided.

@satriahrh
Copy link

Is it possible that your server only accepting sftp connection? From what I see here, deleting remote files requires ssh access.

https://github.com/wlixcc/SFTP-Deploy-Action/blob/master/entrypoint.sh#L47-L58

# delete remote files if needed
if test $9 == "true";then
  echo 'Start delete remote files'
  ssh -o StrictHostKeyChecking=no -p $3 -i $TEMP_SSH_PRIVATE_KEY_FILE $1@$2 rm -rf $6
fi


if test $7 = "true"; then
  echo "Connection via sftp protocol only, skip the command to create a directory"
else
  echo 'Create directory if needed'
  ssh -o StrictHostKeyChecking=no -p $3 -i $TEMP_SSH_PRIVATE_KEY_FILE $1@$2 mkdir -p $6
fi

@SimonIT
Copy link
Author

SimonIT commented Jul 15, 2023

Yes, that's exactly why I opened this issue

@mvoggenreiter
Copy link

I have the same problem. I only have sftp access but no ssh access to the target server.
Anyway, I think the issue is more severe, if delete_remote_files=true and sftp_only=true because the first command checks only if we want to delete the directory, but the second one won't be executed at all. In my opinion, the first command has to check for sftp_only as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants