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?的更多相关文章

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

    用持续集成工具Travis进行构建和部署 用持续集成工具Travis进行构建和部署 摘要:本文简单说明了如何使用持续集成工具Travis进行构建和部署的过程. 1. 概述 持续集成(Continuou ...

  2. 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 Pau ...

  3. Fedora 22中的DNF软件包管理工具

    Introduction DNF is the The Fedora Project package manager that is able to query for information abo ...

  4. Spring Boot文档阅读

    原因之初 最初习惯百度各种博客教程,然后跟着操作,因为觉得跟着别人走过的路走可以少走很多弯路,省时间.然而,很多博客的内容并不够完整,甚至错误,看多了的博客甚至有千篇一律的感觉.此外,博客毕竟是记载博 ...

  5. I can connect to an FTP site but I can't list or transfer files.

    原文 FTP sessions use two network connections: The control channel is for user authentication and send ...

  6. Monitoring and Tuning the Linux Networking Stack: Receiving Data

    http://blog.packagecloud.io/eng/2016/06/22/monitoring-tuning-linux-networking-stack-receiving-data/ ...

  7. 【Java】运用JDBC实现一个注册、登录系统的编写

    数据库的建立 首先,建立一个数据库,存储注册成功的账户信息. 其SQL的DDL语句如下: CREATE TABLE `jdbctest` ( `id` int(10) NOT NULL auto_in ...

  8. Android手机外置SD卡(TF卡)的获取方法

    Android手机上的外置SD卡,起初的时候,即在Android出世的前几年,那时手机的存储是十分有限的,不像现在到处可见16G.32G和64G的存储,因而那时候的手机有的厂商允许插入外置的SD卡,此 ...

  9. kerberos环境storm配置:Running Apache Storm Securely

    Running Apache Storm Securely Apache Storm offers a range of configuration options when trying to se ...

随机推荐

  1. UML 小结(2)- 理论理解

    什么是UML: UML是统一建模语言(UML是 Unified Modeling Language的缩写)是用来对软件密集系统进行可视化建模的一种语言. UML为面向对象开发系统的产品进行说明.可视化 ...

  2. 设计模式Builder(建造者)模式

    1.出现原因 在软件系统中,有时候会面临着“一个复杂对象”的创建工作,其通常由各个部分的子对象用一定的算法构成:由于需求的变化,这个复杂的对象的各个部分可能面临着剧烈的变化,但是把他们组合在一起的算法 ...

  3. iOS10.0 TabBar Bug(底部同时展示原生和自定义tabBar)-b

    在没有发布iOS10的时候,在任何模拟器测试下效果正常,更新iOS10后,测试出现BUG先放一张bug之前的效果图: 修改前出现的bug 在检查了所有问题之后,最后把问题定位在了原生系统tabBar底 ...

  4. lucas求组合数C(n,k)%p

    Saving Beans http://acm.hdu.edu.cn/showproblem.php?pid=3037 #include<cstdio> typedef __int64 L ...

  5. xargs 加 gm批量转换图片

    %x50% @ ../-\ 南澳西涌_50%/@ 看了很多说明上都在用-i,这是一个已经废弃了的参数

  6. Unity3D脚本中文系列教程(十)

    http://dong2008hong.blog.163.com/blog/static/4696882720140312627682/?suggestedreading&wumii Unit ...

  7. LVS+Keepalived实现高可用集群

    LVS+Keepalived实现高可用集群来源: ChinaUnix博客 日期: 2009.07.21 14:49 (共有条评论) 我要评论 操作系统平台:CentOS5.2软件:LVS+keepal ...

  8. POJ2411 Mondriaan's Dream 轮廓线dp

    第一道轮廓线dp,因为不会轮廓线dp我们在南京区域赛的时候没有拿到银,可见知识点的欠缺是我薄弱的环节. 题目就是要你用1*2的多米诺骨排填充一个大小n*m(n,m<=11)的棋盘,问填满它有多少 ...

  9. [STL]算法的泛化过程

    “选择了错误的算法,便注定了失败的命运”.最近对这句话感触颇深,经常因为一开始思路错误,修改半天,到头来却都是无用功,所以学好算法势在必行. 算法的泛化过程 如何设计一个算法,使他适用于任何(大多数) ...

  10. grunt安装失败处理

    1.官网 Grunt官网 http://gruntjs.com 2.前言 前段时间一不小心升级了win10(万恶的360),各种不适应各种问题各种软件bug,最终决定回退到win7,然后悲催的发现系统 ...