Snippet to use in your scripts to execute them only if you have root privileges.
if [ $UID -ne 0 ]; then
echo "Superuser privileges are required to run this script."
echo "e.g. \"sudo $0\""
exit 1 fi
Tag: root
-
Snippet to check root privileges
-
Change password for mysql root user on debian
You can perform the password change with mysqladmin command
mysqladmin -u root password "newpwd"
mysqladmin -u root -h host_name password "newpwd"