From c8a181e847660bb9d7faedad0bed7d05afbe8103 Mon Sep 17 00:00:00 2001 From: Scott Garman Date: Sun, 3 Oct 2010 21:39:14 -0700 Subject: poky-qemu-ifup/ifdown: Require root privileges to run This fixes [BUGID #232], requiring root privileges to run these scripts and giving an error prompt when that requirement is not met. The tunctl uid fallback code has also been removed, as we can rely on the specific version of tunctl run from the native sysroot. Signed-off-by: Scott Garman --- scripts/poky-qemu-ifdown | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'scripts/poky-qemu-ifdown') diff --git a/scripts/poky-qemu-ifdown b/scripts/poky-qemu-ifdown index 93a87559af..ece2dc998a 100755 --- a/scripts/poky-qemu-ifdown +++ b/scripts/poky-qemu-ifdown @@ -1,6 +1,15 @@ #!/bin/bash # -# QEMU network interface configuration script. +# QEMU network configuration script to bring down tap devices. This +# utility needs to be run as root, and will use the tunctl binary +# from a Poky sysroot. +# +# If you find yourself calling this script a lot, you can add the +# the following to your /etc/sudoers file to be able to run this +# command without entering your password each time: +# +# ALL=NOPASSWD: /path/to/poky-qemu-ifup +# ALL=NOPASSWD: /path/to/poky-qemu-ifdown # # Copyright (c) 2006-2010 Intel Corp. # @@ -18,9 +27,14 @@ # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. usage() { - echo "$0 " + echo "sudo $0 " } +if [ $EUID -ne 0 ]; then + echo "Error: This script (poky-qemu-ifdown) must be run with root privileges" + exit 1 +fi + if [ $# -ne 2 ]; then usage exit 1 -- cgit v1.2.3-54-g00ecf