![]() Why is sudo better than the alternatives? Sudo is like saying the magic word. It might as well be named opensesame or abracadabra or even bippityboppitybacon. ![]() Finally we see the broadcast message that the system will be rebooted now. We then try with sudo reboot. Sudo asks for your user password. Note that it is asking for your password, not the root password. First, we use the reboot command to try and reboot the system. The command fails citing: “must be superuser”. Watch what happens in this screenshot if we don’t first elevate our permissions with sudo. All your worst fears have come true, but all you needed to do was ask for permission! That’s why we want to remember to ask for superuser permissions upfront like this: sudo reboot That awesome source code you downloaded and need to compile wont. You might even be lucky enough to given an “Access Denied” or another friendly error message. ![]() It’s more of a dramatic story in Linux. Things might behave quite strangely without the proper permissions. The important config file you were editing may not save correctly. A program you installed may simply refuse to run. In Windows, if you try to perform an administrative task, a dialog box asks you if you wish to continue (“Are you really sure your want to run that program you just clicked on?”). The task is then performed. On a Mac, a security dialog box pops up and you are required to type in your password and click OK. You even need elevated privileges to shutdown or restart the computer. “Hey, who turned this thing off?!” If you’re familiar with Windows, it’s very similar to the Windows User Account Control dialog box that pops up when you try to do anything important, just not as friendly. So, what is sudo for and what does it do? If you prefix “sudo” with any Linux command, it will run that command with elevated privileges. Elevated privileges are required to perform certain administrative tasks. Someday you may wish to run a LAMP (Linu Apache MySQL PHP) server, and will have to manually edit your config files. You might also have to restart or reset the Apache web server or other service daemons. ![]()
0 Comments
Leave a Reply. |