I think the -P usage is correct. The error is 403, not 401. But I think the problem is that I'm somehow not in the "package uploaders" group.

$ cabal upload --help
Uploads source packages or documentation to Hackage.
...
 -p, --password=PASSWORD        Hackage password.
 -P, --password-command=PASSWORD
                                Command to get Hackage password.


On Wed, Jun 1, 2022 at 7:33 PM Brandon Allbery <allbery.b@gmail.com> wrote:
On Wed, Jun 1, 2022 at 7:22 AM ☂Josh Chia (謝任中) <joshchia@gmail.com> wrote:
> $ cabal upload -u jchia -P 'cat /tmp/pw' /home/jchia/gh/direct-sqlite/dist-newstyle/sdist/direct-sqlite-2.3.27.tar.gz

I think the single quotes (') there are intended to be backquotes (`).

--
brandon s allbery kf8nh
allbery.b@gmail.com