How to enable OIDC login for admins in SFTPGo

Created: — modified: — tags: oidc

Note that it's more "how i did it", not "how you should do it", but i'm not aware of a better way to do it

  1. Assume you've already enabled OIDC for users, and figured out Dynamic user creation - so now anyone having an account with your selected OIDC provider can have a user account at your SFTPGo server. Nice!
  1. You probably noticed that when an admin tries to login - the pre_login_hook doesn't fire, so you can't dynamically create admins. Moreover, the admin login page doesn't have a button to login with openid!

  2. first enable the implitcit_roles setting - it will add "login with openid" button to the admin login page

  3. To create an admin OIDC user, create a new admin user with the same username as OIDC provides. If you're not sure what username it is - just login as normal user (i.e. create a normal SFTPGo user for this OIDC user), and check its username.

  4. After that, confirm that you can login as the admin user using OIDC, and disable password login by setting disabled_login_methods to 12.