Replies: 2 comments
-
|
This is an interesting use case to me. Perhaps put some debugging in the script to see what the json user representation returned by the script to stdout looks like when logging in via sftp vs ui and if they are identical, it sounds like a possible bug. |
Beta Was this translation helpful? Give feedback.
-
|
If I had to guess, I think sftpgo is using a user id which is not the user's username to create the user in the database and because the original login request username does not have |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem Description
I’m using SFTPGo with Azure AD (AAD) for user registration and authentication.
Authentication is based on the
preferred_usernameclaim from the AAD JWT token, which is always the user's email address (e.g.,user@email.com).Because of this, all users in the SFTPGo MySQL backend also have their email address as the username, and I cannot change that (it would break AAD authentication).
The issue
When users connect via SFTP, the only login format that works is:
However, I want them to be able to log in using the shorter, more typical form:
Question
Is there a supported way in SFTPGo to allow login aliases (e.g.,
user→user@email.com) so users can authenticate with a short username while SFTPGo still uses the full email address internally for AAD/JWT validation?If so, what’s the recommended configuration approach?
What I have tried (pre-login hook)
I attempted to use a pre-login hook to rewrite the short username user into the full AAD username
user@example.comwhen the login method ispublickey.Here is the relevant part of
pre-login-hook.sh:When I test login using:
This happens because:
So the hook is not rewriting the username for authentication — it's triggering a duplicate-user creation attempt.
Is there another recommended mechanism (e.g., username aliasing, mappings, or different hook logic) that will allow
user→user@example.comwhile still authenticating against the IDP user?Beta Was this translation helpful? Give feedback.
All reactions