Skip to content

bug(Windows): using podman system connection add with a ~ should convert it to absolute path #26016

Open
@axel7083

Description

@axel7083

Issue Description

TL;DR We cannot use a tilde for the identity on windows for system connections: podman should either prevent user to do it, or resolve the path

I was following the https://github.com/containers/podman/blob/main/docs/tutorials/remote_client.md tutorial and the part about adding the connections let me think I could use ~ for the identity.

podman-remote system connection add myuser --identity ~/.ssh/id_ed25519 ssh://myuser@192.168.122.1/run/user/1000/podman/podman.sock

Steps to reproduce the issue

Steps to reproduce the issue

  1. be on windows
  2. have a distant podman machine running
  3. add connection with a tilde ~
$: podman system connection add remote-tilde --identity ~/.ssh/id_ed25519 ssh://<user>@<ip>/run/user/1000/podman/podman.sock

Describe the results you received

$: podman --connection=remote-tilde info
OS: windows/amd64
provider: wsl
version: 5.4.0

Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM
Error: unable to connect to Podman socket: failed to read identity "~/.ssh/id_ed25519": open ~/.ssh/id_ed25519: The system cannot find the path specified

Describe the results you expected

The proper output of podman info of the remote

podman info output

podman version 5.4.0

Podman in a container

No

Privileged Or Rootless

None

Upstream Latest Release

Yes

Additional environment details

N/A

Additional information

When we use podman system connection add we call the following code

return ssh.Create(entities, sshMode)

which is inside the https://github.com/containers/common repository, specifically the problem occurs on key, err := os.ReadFile(path)1.

Footnotes

  1. https://github.com/containers/common/blob/aca5d21079aed68abaf848642e7056156df84ee9/pkg/ssh/utils.go#L99

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.triagedIssue has been triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions