From d8c2962188a8c6900e609c0dced5a662fcc18272 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 29 Aug 2018 10:24:50 +0200 Subject: rootless: show an error when pause/unpause are used Signed-off-by: Giuseppe Scrivano Closes: #1371 Approved by: rhatdan --- cmd/podman/main.go | 2 ++ cmd/podman/pause.go | 4 ++++ cmd/podman/unpause.go | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/cmd/podman/main.go b/cmd/podman/main.go index 06d9308e0..538eaaac2 100644 --- a/cmd/podman/main.go +++ b/cmd/podman/main.go @@ -32,6 +32,8 @@ var cmdsNotRequiringRootless = map[string]bool{ "login": true, "logout": true, "kill": true, + "pause": true, + "unpause": true, "search": true, "stop": true, "top": true, diff --git a/cmd/podman/pause.go b/cmd/podman/pause.go index 12ff747a7..e8a576599 100644 --- a/cmd/podman/pause.go +++ b/cmd/podman/pause.go @@ -25,6 +25,10 @@ var ( ) func pauseCmd(c *cli.Context) error { + if os.Getuid() != 0 { + return errors.New("pause is not supported for rootless containers") + } + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") diff --git a/cmd/podman/unpause.go b/cmd/podman/unpause.go index d0c622b8a..d5b2732af 100644 --- a/cmd/podman/unpause.go +++ b/cmd/podman/unpause.go @@ -25,6 +25,10 @@ var ( ) func unpauseCmd(c *cli.Context) error { + if os.Getuid() != 0 { + return errors.New("unpause is not supported for rootless containers") + } + runtime, err := libpodruntime.GetRuntime(c) if err != nil { return errors.Wrapf(err, "could not get runtime") -- cgit v1.2.3-54-g00ecf