Skip to content

image scp: preserve usernames containing an "@"#28897

Open
ROKUMATE wants to merge 1 commit into
podman-container-tools:mainfrom
ROKUMATE:fix-image-scp-at-username
Open

image scp: preserve usernames containing an "@"#28897
ROKUMATE wants to merge 1 commit into
podman-container-tools:mainfrom
ROKUMATE:fix-image-scp-at-username

Conversation

@ROKUMATE

Copy link
Copy Markdown

Problem

podman image scp parses the user@localhost::image argument by cutting on the
first @. When the username itself contains an @ — e.g. an Active Directory
account like user@domain — it gets truncated to just user:

$ sudo podman image scp aduser@domain@localhost::example.com/foo/bar:latest
Error: user: unknown user aduser

Impact

Users on AD-joined (or any user@domain) machines can't use podman image scp
to copy images between users — the local user lookup fails before the transfer
even starts.

Fix

In ParseImageSCPArg, the @localhost:: case only ever matches that exact
separator, so split the argument on @localhost:: instead of the bare @. This
keeps the full username (including any @domain) and leaves the remote
user@host:: SSH path unchanged.

user@localhost::img          -> user        (unchanged)
user@domain@localhost::img   -> user@domain  (fixed)

Test

Added TestParseImageSCPArg in pkg/domain/utils/scp_test.go covering both the
plain user and the user@domain cases. go test ./pkg/domain/utils/ passes.

Fixes: #27655

@packit-as-a-service

Copy link
Copy Markdown

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@danishprakash danishprakash left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, but can you squash your commits into one and sign it?

@ROKUMATE ROKUMATE force-pushed the fix-image-scp-at-username branch from d2bd334 to 6c69383 Compare June 10, 2026 07:51
@ROKUMATE

Copy link
Copy Markdown
Author

check now

@Honny1 Honny1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a fast check, and it seems good. Can you please add an integration test?

Signed-off-by: ROKUMATE <rohitkumawat0110@gmail.com>
@ROKUMATE ROKUMATE force-pushed the fix-image-scp-at-username branch from 6c69383 to c1a1ffb Compare June 10, 2026 08:58
@ROKUMATE

Copy link
Copy Markdown
Author

Added the integration test as well 👍

@runiq

runiq commented Jun 10, 2026

Copy link
Copy Markdown

OP from the original issue here, I'd just like to say thanks a lot for implementing this ❤️

@ROKUMATE

Copy link
Copy Markdown
Author

@runiq thanks to you to for helping me find my first issue for contributation 🙇🏼

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow using podman image scp with a user with an @ in the name

4 participants