From 30caa5b60c6ba6e154ccdff21c177688bb741c58 Mon Sep 17 00:00:00 2001 From: Carlos Perez Date: Fri, 10 Jun 2011 11:14:57 +0000 Subject: [PATCH] remove hard coding of path for id command git-svn-id: file:///home/svn/framework3/trunk@12902 4d416f70-5f16-0410-b530-b9f4589650da --- lib/msf/core/post/linux/priv.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/msf/core/post/linux/priv.rb b/lib/msf/core/post/linux/priv.rb index b615c753e4..a85e5024de 100644 --- a/lib/msf/core/post/linux/priv.rb +++ b/lib/msf/core/post/linux/priv.rb @@ -9,9 +9,13 @@ module Priv # Returns true if running as root, false if not. def is_root? root_priv = false - user_id = cmd_exec("/bin/id -u") + user_id = cmd_exec("id -u") if user_id.to_i == 0 root_priv = true + elsif user_id =~ /^\d*$/ + root_priv = false + else + raise "Could not determine UID: #{user_id}" end return root_priv end