From 8d6877239c3e6d1dbe2b2aa1b3661a36c39ea220 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 28 Nov 2020 23:02:58 +0000 Subject: [PATCH] mkswap: tell how to fix insecure permissions and owner in warning Signed-off-by: Sami Kerola --- disk-utils/mkswap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c index 631e702849..87718331bc 100644 --- a/disk-utils/mkswap.c +++ b/disk-utils/mkswap.c @@ -587,12 +587,12 @@ int main(int argc, char **argv) open_device(&ctl); permMask = S_ISBLK(ctl.devstat.st_mode) ? 07007 : 07077; if ((ctl.devstat.st_mode & permMask) != 0) - warnx(_("%s: insecure permissions %04o, %04o suggested."), + warnx(_("%s: insecure permissions %04o, fix with: chmod %04o %s"), ctl.devname, ctl.devstat.st_mode & 07777, - ~permMask & 0666); + ~permMask & 0666, ctl.devname); if (getuid() == 0 && S_ISREG(ctl.devstat.st_mode) && ctl.devstat.st_uid != 0) - warnx(_("%s: insecure file owner %d, 0 (root) suggested."), - ctl.devname, ctl.devstat.st_uid); + warnx(_("%s: insecure file owner %d, fix with: chown 0:0 %s"), + ctl.devname, ctl.devstat.st_uid, ctl.devname); if (ctl.check) -- 2.47.3