Skip to content

Commit 40ff69c

Browse files
Copilotigaw
andcommitted
ci: use ~/.ssh/config for SFTP auth options instead of CLI flags
Passing -o flags directly on the sftp -b - command line doesn't work: sftp batch mode reads commands from stdin, conflicting with how sshpass intercepts the password prompt when inline options are present. Write a ~/.ssh/config stanza for ${SFTP_SERVER} containing: PubkeyAuthentication no PreferredAuthentications password Using grouped echo commands (avoids heredoc/YAML indentation issues). Also add chmod 600 on the config file as required by SSH. Co-authored-by: igaw <[email protected]>
1 parent 0a00104 commit 40ff69c

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/upload.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,19 @@ jobs:
7676
sudo apt-get install -y sshpass
7777
mkdir -p ~/.ssh
7878
echo "${SFTP_HOST_KEY}" > ~/.ssh/known_hosts
79+
{
80+
echo "Host ${SFTP_SERVER}"
81+
echo " PubkeyAuthentication no"
82+
echo " PreferredAuthentications password"
83+
} > ~/.ssh/config
84+
chmod 600 ~/.ssh/config
7985
(
8086
echo "cd /upload"
8187
for f in upload/nvme-cli-*; do
8288
[ -f "$f" ] || continue
8389
echo "put $f $(basename "$f")"
8490
done
85-
) | sshpass -e sftp -b - \
86-
-o PubkeyAuthentication=no \
87-
-o PreferredAuthentications=password \
88-
"${SFTP_USERNAME}@${SFTP_SERVER}"
91+
) | sshpass -e sftp -b - "${SFTP_USERNAME}@${SFTP_SERVER}"
8992
9093
upload-release-assets:
9194
name: upload GitHub release assets

0 commit comments

Comments
 (0)