Skip to content
This repository

Replace "whoami" call with call to "id" in install_server.sh #781

Open
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.

 http://refspecs.linuxfoundation.org/LSB_4.1.0/LSB-Core-generic/LSB-Core-generic/command.html
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/install_server.sh
4  utils/install_server.sh
@@ -42,8 +42,8 @@ echo "This script will help you easily set up a running redis server
42 42
 
43 43
 "
44 44
 
45  
-#check for root user TODO: replace this with a call to "id"
46  
-if [ `whoami` != "root" ] ; then
  45
+#check for root user
  46
+if [ `id -u` != 0 ] ; then
47 47
 	echo "You must run this script as root. Sorry!"
48 48
 	exit 1
49 49
 fi
Commit_comment_tip

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.