Skip to content

Commit d0f8d56

Browse files
committed
Make sure authorized_keys is ending with EOL when adding a SFTP key
1 parent 79429dc commit d0f8d56

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

bin/v-add-user-sftp-key

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ if [ ! -f "${AUTHKEY_FILE}" ] || [ "$new_pubkey" = true ]; then
6262
sed -i "/ \[${user}\]filemanager\.ssh\.key\$/d" "${AUTHKEY_FILE}"
6363
fi
6464

65+
# make sure authorized_keys is ending with EOL
66+
sed -i '$a\' "${AUTHKEY_FILE}"
67+
6568
echo "from=\"127.0.0.1\",command=\"internal-sftp\",restrict ${pubkey_str} TS:${now} ${pubkey_desc}" >> "${AUTHKEY_FILE}"
6669

6770
fi

0 commit comments

Comments
 (0)