Wiki


FreeBSD - Give "sudo" root privileges

Locked

User Rating: 0 / 5

Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 
Contents[Hide]
Contents[Hide]

freebsd

 

On FreeBSD, CodeTyphon setup request sudo root privileges

What is sudo ?

Users in the sudoers list are allowed the privileges to run commands and open files as the root user.

How to add a user to the sudoers list:
Open the file “sudoers” located at /usr/local/etc/sudoers using your favorite text editor.
You must have root permissions to be able to edit this file so you will want to open your editor from the command line.

a) To use gedit you would do the following:
Open the Terminal and type:
  su                                                    
  gedit  /usr/local/etc/sudoers    

b) If you want to use vim you can simply enter the following into the Terminal:
  su         
  visudo  

c) If you want to use nano you can simply enter the following into the Terminal:
  su                                                
nano /usr/local/etc/sudoers    


 

1. The first way

is to add your specific user to the list
Once you have the sudoers file open, add as last line:

user    ALL=(ALL) NOPASSWD: ALL
Defaults: user timestamp_timeout=-1

Ctrl+x to exit from nano and choose save (y/Y).
The new user has now been added to the “sudoers” file and can use the “sudo” command passwordless.

sudo-freebsd

Note: You can add as last line end
user   ALL = (ALL)  ALL
sudo will request your password in every “sudo” command.
In this case you must NOT use  "Run Embedded"  icon5  in CTC CommandBox page. 


 

2. The second way

is to enable the entire 'wheel' group to use sudo.
The default user created during installation belongs to this group or you can add your <<user>> to this group.
Once you have the sudoers file open, scroll down to the line:

# Same thing without a password
#%wheel ALL=(ALL) NOPASSWD: ALL

Make the previous line look like the following:

# Same thing without a password
%wheel ALL=(ALL) NOPASSWD: ALL
<<==

Uncommenting that line will allow all users in 'wheel' to use sudo command passwordless.
Ctrl+x to exit from nano and choose save (y/Y).

sudo-freebsd2