Skip to content
This repository

Replace "whoami" call with call to "id" in #781

wants to merge 1 commit into from

1 participant

Caleb Perkins
Caleb Perkins

id -u is in the POSIX and LSB specs 1, while whoami is not.
Furthermore, the username of UID 0 can be changed (and is sometimes
recommended in a misguided attempt to increase security).

FreeBSD users logged in as toor would also slip through the cracks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Nov 20, 2012
Caleb Perkins Replace "whoami" call with call to "id" 8b37701
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  utils/
4  utils/
@@ -42,8 +42,8 @@ echo "This script will help you easily set up a running redis server
42 42
43 43
44 44
-#check for root user TODO: replace this with a call to "id"
-if [ `whoami` != "root" ] ; then
+#check for root user
+if [ `id -u` != 0 ] ; then
47 47
 	echo "You must run this script as root. Sorry!"
48 48
 	exit 1
49 49

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.