If you want to be able to use the sudo command in Debian to do superuser tasks as your normal user, then you need to edit the /etc/sudoers file to be able to perform administrator tasks as a normal user with sudo.
Add the user lovecraft to the sudoers file like this.
lovecraft ALL=(ALL:ALL) ALL |
This will require a password, but will allow the user to run sudo.
To not require a password, use this instead.
lovecraft ALL=NOPASSWD: ALL |
This option is not recommended for security reasons, but I will put it in here anyway. You are better off using a password every time.
ubuntu ~ $ sudo cat /etc/sudoers # # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in /etc/sudoers.d/ instead of # directly modifying this file. # # See the man page for details on how to write a sudoers file. # Defaults env_reset Defaults mail_badpass Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin" # Host alias specification # User alias specification # Cmnd alias specification # User privilege specification root ALL=(ALL:ALL) ALL # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL lovecraft ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "#include" directives: #includedir /etc/sudoers.d |
Use the visudo command to do the editing of the /etc/sudoers file, this will make sure the file is properly edited without errors before it is saved. Otherwise you could lock yourself out of your system. in this example on Debian 6.0 I am using the username lovecraft and I have added myself to the /etc/sudoers file to be able to use sudo but still requiring to system to ask me for a password.
The members of the group sudo can execute commands as root, and I could have added my user to this group, but I preferred to do it this way. using sudo requires you to have a very strong password on your normal user account as well as your root account unless you disable it with this command: sudo passwd -l root. This is how Ubuntu is set up, the root account is disabled and the sudo command is used to do superuser tasks. But you can set a password for the root account on Ubuntu by typing sudo passwd root
.
The sudo passwd -l root
command will lock out the root account. This is useful if you want to use sudo instead.
Use the sudo -l parameter to determine which commands a user may run.
4.4 Wed Aug 14 jason@Yog-Sothoth 0: $ sudo -l 1) All commands run with root privileges are always dangerous. 2) Never run commands on an environment you are not willing to destroy, or able to restore. 3) Do not become root until you know what you are going to do. 4) Be sure of your command and what is going to be affected by it. [sudo] password for jason: Matching Defaults entries for jason on Yog-Sothoth: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, lecture=always, lecture_file=/root/lecture, secure_path=/usr/local/sbin\:/usr/local/bin\:/opt/trinity/sbin\:/usr/sbin\:/opt/trinity/bin\:/usr/bin\:/sbin\:/bin\:/usr/X11R6/bin User jason may run the following commands on Yog-Sothoth: (ALL : ALL) ALL |
If the administrator adds this to the /etc/sudoers file and then writes a nice lecture in the file, it will print a reminder of sudo rules and dangers before the user runs a command with it.
Defaults lecture="always" Defaults lecture_file="/root/lecture" |
Set Gcc for cmake.
https://stackoverflow.com/questions/17275348/how-to-specify-new-gcc-path-for-cmake