summaryrefslogtreecommitdiff
path: root/cmd/podman/main.go
diff options
context:
space:
mode:
authorcdoern <cdoern@redhat.com>2021-11-21 22:48:32 -0500
committercdoern <cdoern@redhat.com>2021-12-23 10:10:51 -0500
commitf6d00ea6ef977bbaf167d1187d1e4e43632f6b5c (patch)
tree5e18ea3a21b871224cef030c0fb178dbd9ae0ca5 /cmd/podman/main.go
parentb6ce7e19ec45c8bfd95356e03eb55090213887b4 (diff)
downloadpodman-f6d00ea6ef977bbaf167d1187d1e4e43632f6b5c.tar.gz
podman-f6d00ea6ef977bbaf167d1187d1e4e43632f6b5c.tar.bz2
podman-f6d00ea6ef977bbaf167d1187d1e4e43632f6b5c.zip
podman image scp never enter podman user NS
Podman image scp should never enter the Podman UserNS unless it needs to. This allows for a sudo exec.Command to transfer images to and from rootful storage. If this command is run using sudo, the simple sudo podman save/load does not work, machinectl/su is necessary here. This modification allows for both rootful and rootless transfers, and an overall change of scp to be more of a wrapper function for different load and save calls as well as the ssh component Signed-off-by: cdoern <cdoern@redhat.com>
Diffstat (limited to 'cmd/podman/main.go')
-rw-r--r--cmd/podman/main.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/podman/main.go b/cmd/podman/main.go
index b7f5f1720..b38734617 100644
--- a/cmd/podman/main.go
+++ b/cmd/podman/main.go
@@ -52,14 +52,14 @@ func parseCommands() *cobra.Command {
// Command cannot be run rootless
_, found := c.Command.Annotations[registry.UnshareNSRequired]
if found {
- if rootless.IsRootless() && os.Getuid() != 0 {
+ if rootless.IsRootless() && os.Getuid() != 0 && c.Command.Name() != "scp" {
c.Command.RunE = func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("cannot run command %q in rootless mode, must execute `podman unshare` first", cmd.CommandPath())
}
}
} else {
_, found = c.Command.Annotations[registry.ParentNSRequired]
- if rootless.IsRootless() && found {
+ if rootless.IsRootless() && found && c.Command.Name() != "scp" {
c.Command.RunE = func(cmd *cobra.Command, args []string) error {
return fmt.Errorf("cannot run command %q in rootless mode", cmd.CommandPath())
}