![]() That # symbol means “DANGER! YOU’RE LOGGED IN AS ROOT!”. The first command you issue may go well. But your forgetfulness will cause you to stay logged in as root. Sudo is the best and safest way to elevate privileges. Let’s take a look at another way of doing things. The switch user command “su” will ask you for the root password and give you a super user prompt, signified by the # symbol. 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. Now in order to check that ‘sudo’ can be used with the new user account, invoke any command which require superuser privileges.Sudo, the one command to rule them all. It stands for “super user do!” and is pronounced like “sue dough”.Īs a Linux system administrator or power user, it’s one of the most important commands in your arsenal. Have you ever tried to run a command in terminal only to be given “Access Denied?”. Well this is the command for you! But, with great power comes great responsibility! Running the sudo command is much better than logging in as the root user, or using the su “switch user” command. Read on to see what sudo can do for you! What is sudo for? ![]() In order to switch to the new user account, type in the su command as shown below : Sudo access privilege is granted to all members of the sudo group by default on Ubuntu.In order to add the new user you have created to the sudo group, you can use the usermod command as shown below :Īdd user to sudoers Debian 4-Sudo access test ![]() You may be interested to read: The Sudoers File in UbuntuĪfter setting the password, the command above will set up a home folder for the new user as well as copy various configuration files in the home folder. ![]() Make sure to provide a complex password that can not be hacked. You will then be prompted in order to confirm the new user password, and other credentials (you can leave them blank by pressing ENTER to accept the default). In order to add a new user to the system, use the adduser command.Make sure to replace the username below with the new username to be created. Simple steps to create a new sudo user 1.Log in as the root user to your system: You will then be able to execute commands which require administrator privileges without logging in as a root user. This will be achieved without modifying the server’s Ubuntu sudoers file. In this short article, you will find an easy way to create a powerful new user who will have sudo access on Ubuntu. Normal users can acquire administrator privileges which is usually held by the root user, via the sudo command. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |