Score:0

Password in /etc/apt/auth.conf gets rejected when password contains spaces and an exclamation point

gr flag

In /etc/apt/auth.conf, I have the lines

machine example.org/nexus/repository/my_apt_repo/
login my_usename
password not my actual password 1!

Attempting to run sudo apt update results in the error message

E: Failed to fetch https://example.org/nexus/repository/my_apt_repo/dists/bionic/main/binary-amd64/Packages  401  Unauthorized 

This seems to try and fail to log in often enough to freeze my credentials temporarily.

This has been set up by an ansible playbook that works for other people, and I can log in to nexus with the given credentials and fetch a package.

I presume this is a matter of needing to escape the password somehow. Is this correct, and if yes, how do I escape spaces, exclamation points etc. in my password?

There is a question about configuring http proxy login, but the accepted answer does not solve this issue because this is a different configuration.

in flag
Generally one can escape these characters with a \
Haem avatar
gr flag
@matigo that does not appear to be the case here.
Score:0
cn flag

2 methods:

  • use html encoding

    1 \&<>"' becomes 1%5C%20%26%3C%3E%22%27

  • use a \

    1 \&<>"' becomes 1\\\ \&\<\>\"\'

Easier fix: change the password to one that excludes special characters. I tend to use a random password generator and exlude special symbols and ambiguous characters.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.