quinta-feira, 6 de março de 2014

[Linux] Give sudo to a user / Dar sudo para um usuário

To give sudo to a user, you need edit /etc/sudoers with root

# vim /etc/sudoers
or
# nano /etc/sudoers

If the file does not exist, see:
http://guihatano.blogspot.com.br/2014/03/instalando-sudo-install-sudo.html


The file looks like:

#
# 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"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
newuser ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d

Add the new user  and save it.
And that's it!

-------------------------------------------------------------------------------------------------------

Para dar sudo à um usuário, você precisa editar o arquivo /etc/sudoers com o root

use:
# vim /etc/sudoers
or
# nano /etc/sudoers
O arquivo se parece com isso:

#
# 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"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
novousuario ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d

Adicione o novo usuário e salve.
E é isso!

Nenhum comentário:

Postar um comentário