How can I add a new user as sudoer using the command line?

Two ways to use sudo command for a standard user account:

First,

If you want to use sudo command for a standard user account, then you need to
add this account to /etc/sudoers file. Use the following steps to add your
desired user account to /etc/sudoers file:

  • login as administration : i.e.   su – adminuser

  • type sudo visudo

  • Find out the following

# User privilege specification
root ALL=(ALL) ALL
%admin ALL=(ALL)
ALL

  • Add your user account below “root ALL=(ALL) ALL”.  For
    example:

# User privilege specification
root ALL=(ALL)
ALL
yourusername ALL=(ALL) ALL
%admin ALL=(ALL)
ALL

    • Save your file (:wq), and now you will be able to use sudo command
      for your username.

Second(Recommended),

Just add the user to the sudo group:

sudo adduser <username> sudo

The change will take effect the next time the user logs in.

This works because /etc/sudoers is pre-configured to
grant permissions to all members of this group (You should not have to make any
changes to this):

# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL

As long as you have access to a user that is in the same groups as your
"original" user, you can delete the old one.


Realistically, there are also other groups your new user should be a member
of. If you set the Account type of a user to Administrator in Users Settings, it
will be placed in at least all of these groups:

adm sudo lpadmin sambashare

Because your system configuration may vary, I suggest taking a look at the
output of groups <username> to see what groups are
normally in use.

How can I add a new user as sudoer using the command
line?,码迷,mamicode.com

How can I add a new user as sudoer using the command
line?

时间: 2024-12-19 01:53:41

How can I add a new user as sudoer using the command line?的相关文章

用持续集成工具Travis进行构建和部署

用持续集成工具Travis进行构建和部署 摘要:本文简单说明了如何使用持续集成工具Travis进行构建和部署的过程. 1. 概述 持续集成(Continuous Integration)是软件开发过程中的重要环节,不论是在开发环境,还是生产环境,其好处都是可以让团队尽快得到反馈,从而尽早发现和解决问题,不要等到用户来报告问题,影响产品和团队的声誉.越早越快地发现和解决问题,成本越低,这也是敏捷开发的基本目的之一. 持续集成的工具有不少,著名的有CruiseControl.JetBrains的Te

iMX6QD How to Add 24-bit LVDS Support in Android

iMX6QD How to Add 24-bit LVDS Support in Android 版本 4 由 Ying Liu 于 2012-10-14 下午11:52创建,最后由 Jodi Paul 于 2013-5-20 上午8:38修改. Introduction LVDS display panel driving data flow: Display quality: To get the best display quality for 24bit LVDS display pan

关于SYSLINUX的一些重要描述摘录

以下资源都来自官方文档,原文摘录 The SYSLINUX suite contains the following boot loaders ("derivatives"), for their respective boot media: SYSLINUX - MS-DOS/Windows FAT filesystem PXELINUX - PXE network booting ISOLINUX - ISO9660 CD-ROM EXTLINUX - Linux ext2/ext

Intro to pacemaker

Intro to pacemaker on heartbeat http://foaa.de/old-blog/2010/10/intro-to-pacemaker-on-heartbeat/trackback/index.html With squeeze around the corner it's time to reconsider your everything with debian – once again Of course i am aware, that pacemaker

virsh console hangs at the escape character “^]”

I am trying to kickstart a newly built VM. I am stuck with the following. Want to start with a console so that I can include username and other info for this VM: @vmhost02 ~]$ sudo virsh start --console testengine Domain testengine started Connected

python set add 导致问题 TypeError: unhashable type: &#39;list&#39;

问题复现 >>> a = set() >>> b = set() >>> b.add(1) >>> a.add(b) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unhashable type: 'set' >>> c = list(b) >>

How do I add elements to a Scala List?

Scala List FAQ: How do I add elements to a Scala List? This is actually a trick question, because you can't add elements to a ScalaList; it's an immutable data structure, like a Java String. Prepending elements to Scala Lists One thing you can do whe

How to add elements to a List in Scala

Scala List FAQ: How do I add elements to a Scala List? This is actually a trick question, because you can't add elements to a ScalaList; it's an immutable data structure, like a Java String. Prepending elements to Scala Lists One thing you can do whe

&lt;add assembly=&quot;Microsoft.Office.Tools.Word, Version=10.0.0.0, Culture=neutral, PublicKeyToken=B03F5F

Server Error in '/' Application. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appr