Nov
18

Run as root only

By celso

To make sure that a script will be run by root only:


#!/bin/sh

if [ `id -u` != 0 ]; then
  echo "Permission denied, must be root"
  exit
fi

# Do the thing...
Categories : Linux, Notes

Leave a Comment

You must be logged in to post a comment.