From edfd98203767b0080b520697632f2541c8d21e0a Mon Sep 17 00:00:00 2001 From: PartialVolume <22084881+PartialVolume@users.noreply.github.com> Date: Thu, 2 Nov 2023 20:14:52 +0000 Subject: [PATCH] Add_check_for_root_execution --- src/nwipe.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/nwipe.c b/src/nwipe.c index e748a7a4..e93f9361 100644 --- a/src/nwipe.c +++ b/src/nwipe.c @@ -126,6 +126,12 @@ int main( int argc, char** argv ) /* Initialised and populated in device scan. */ nwipe_context_t** c1 = 0; + if( geteuid() != 0 ) + { + printf( "nwipe must run with root permissions, which is not the case.\nAborting\n" ); + exit( 99 ); + } + int wipe_threads_started = 0; /** NOTE ** NOTE ** NOTE ** NOTE ** NOTE ** NOTE ** NOTE ** NOTE ** NOTE **