cmd: drop special handling for "scp"

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2023-03-02 22:15:39 +01:00
parent da04469f06
commit 2860d55c97
2 changed files with 2 additions and 3 deletions

View File

@ -15,8 +15,7 @@ var (
imageScpCommand = &cobra.Command{
Use: "scp [options] IMAGE [HOST::]",
Annotations: map[string]string{
registry.UnshareNSRequired: "",
registry.ParentNSRequired: "",
registry.ParentNSRequired: "",
},
Long: saveScpDescription,
Short: "securely copy images",

View File

@ -76,7 +76,7 @@ func parseCommands() *cobra.Command {
// Command cannot be run rootless
_, found := c.Command.Annotations[registry.UnshareNSRequired]
if found {
if rootless.IsRootless() && os.Getuid() != 0 && c.Command.Name() != "scp" {
if rootless.IsRootless() && os.Getuid() != 0 {
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())
}