Removed sudo prefixing commands. Script should be run as root or invoked with sudo.