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. 作业三--Linux内核分析

    一.Linux内核源码 arch目录支持不同CPU的源代码,是内核源码中比较大的文件. fs文件系统Linux内核的源码放在kernel目录中. 二.构造一个简单的Linux系统MenuOS 三.使用 ...

  2. c语言编程之二叉树

    利用链表建立二叉树,完成前序遍历.中序遍历.后序遍历. 建立二叉树用的是前序遍历建立二叉树: #include<stdio.h> #include<stdlib.h> #inc ...

  3. bnuoj 25662 A Famous Grid (构图+BFS)

    http://www.bnuoj.com/bnuoj/problem_show.php?pid=25662 #include <iostream> #include <stdio.h ...

  4. win8安装新字体

    http://jingyan.baidu.com/article/e3c78d640a7ab33c4c85f52d.html

  5. 网络编程之ping

    #include <sys/types.h>#include <netinet/ip.h>#include <netdb.h>#include<arpa/in ...

  6. linux使用:vi编辑器

    初学linux,目前是概念多于操作,所以记录下一些操作: 编辑某个文件():vi 文件名 编辑后保存退出::wq 编辑后不保存退出: :q! 参数:-R 只读模式 -x 文件加密(vim命令下使用) ...

  7. phonegap file操作

    phonegap中,有时候需要操作到手机中的文件,这个时候就需要用到phonegap官方提供的插件 file ,英文好的可以直接参考官方文档 首先是安装插件:(需要phonegap 3.0 以上,不止 ...

  8. winform DataGridView控件开发经验

    1.不让DataGridView控件自动生成列 设置AutoGenerateColumns 为false. dgTicket.AutoGenerateColumns = false; //将自动生成列 ...

  9. crawler

    # !/usr/bin/env python# encoding:UTF-8from util import request_urlimport reimport osimport sys#from ...

  10. java数据结构学习(一)之二分查找

      二分查找法与我们在孩童时期玩过的猜数的游戏一样,这个游戏里一个朋友会让你猜他正想的一个1至100的数,当你猜了一个数后,他会告诉你三种选择的一个:你猜的比她想的大,或小,或猜中了.为了能用最少的次 ...