[virt-bootstrap] [PATCH v7 23/26] Show warning for unprivileged users

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Show warning message and don't allow ownership mapping for non-root
user when the output format is 'dir'.
---
 src/virtBootstrap/virt_bootstrap.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/virtBootstrap/virt_bootstrap.py b/src/virtBootstrap/virt_bootstrap.py
index 2ff1b4b..9190e80 100755
--- a/src/virtBootstrap/virt_bootstrap.py
+++ b/src/virtBootstrap/virt_bootstrap.py
@@ -109,6 +109,13 @@ def bootstrap(uri, dest,
     """
     Get source object and call unpack method
     """
+    if fmt == 'dir' and os.geteuid() != 0:
+        if uid_map or gid_map:
+            raise ValueError("UID/GID mapping with 'dir' format is "
+                             "allowed only for root.")
+        logger.warning("All extracted files will be owned by the current "
+                       "unprivileged user.")
+
     # Get instance of progress storing module
     prog = progress.Progress(progress_cb)
 
-- 
2.13.5

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux