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?的更多相关文章
- 用持续集成工具Travis进行构建和部署
用持续集成工具Travis进行构建和部署 用持续集成工具Travis进行构建和部署 摘要:本文简单说明了如何使用持续集成工具Travis进行构建和部署的过程. 1. 概述 持续集成(Continuou ...
- 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 ...
- Fedora 22中的DNF软件包管理工具
Introduction DNF is the The Fedora Project package manager that is able to query for information abo ...
- Spring Boot文档阅读
原因之初 最初习惯百度各种博客教程,然后跟着操作,因为觉得跟着别人走过的路走可以少走很多弯路,省时间.然而,很多博客的内容并不够完整,甚至错误,看多了的博客甚至有千篇一律的感觉.此外,博客毕竟是记载博 ...
- 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 ...
- Monitoring and Tuning the Linux Networking Stack: Receiving Data
http://blog.packagecloud.io/eng/2016/06/22/monitoring-tuning-linux-networking-stack-receiving-data/ ...
- 【Java】运用JDBC实现一个注册、登录系统的编写
数据库的建立 首先,建立一个数据库,存储注册成功的账户信息. 其SQL的DDL语句如下: CREATE TABLE `jdbctest` ( `id` int(10) NOT NULL auto_in ...
- Android手机外置SD卡(TF卡)的获取方法
Android手机上的外置SD卡,起初的时候,即在Android出世的前几年,那时手机的存储是十分有限的,不像现在到处可见16G.32G和64G的存储,因而那时候的手机有的厂商允许插入外置的SD卡,此 ...
- kerberos环境storm配置:Running Apache Storm Securely
Running Apache Storm Securely Apache Storm offers a range of configuration options when trying to se ...
随机推荐
- Daily Scrum 11.12
摘要:本次会议继续讨论程序的问题以及单元测试和集成测试,本次测试为终审,并且本次得到的为alpha版本的最终版本.本次的Task列表如下: Task列表 出席人员 Today's Task Tomor ...
- DB天气app冲刺二阶段第五天
昨天什么事情也没做..看了一场哆啦a梦 所以就不算冲刺了.. 今天主要就是做了一下需要用到的图片的整理还有的就是UI主界面需要展示用的素材,发现好多东西都需要搜索半天,虽然这个不是什么技术活..但真的 ...
- 特征值分解,奇异值分解(SVD)
特征值分解和奇异值分解在机器学习领域都是属于满地可见的方法.两者有着很紧密的关系,我在接下来会谈到,特征值分解和奇异值分解的目的都是一样,就是提取出一个矩阵最重要的特征. 1. 特征值: 如果说一个向 ...
- input框中value与placeholder的区别
value:是input中预先放置的文字,当鼠标点击之后依然存在,是值的一部分. placeholder:是input中输入位置的默认显示的文字,鼠标点击后仍旧显示,但不属于值,类似于背景.
- C#快速排序算法基础入门篇
相信算法对于许多开发人员来说都是一大难点,之所以难,就像设计模式一样,许多人在阅读之后,没有很好地理解,也不愿意动手上机操作,只停留在理论的学习上面,随着时间推移就慢慢淡忘. 有些东西,你可以发明创造 ...
- QC缺陷管理操作-细说(转)
一.缺陷常用字段说明 二.缺陷管理流程图 三.开发人员修改缺陷填写规范 四.项目经理决定延期修改缺陷 一.缺陷常用字段说明 1.摘要 对缺陷的简单描述.摘要包括该缺陷所属的模块名称-子模块名称,以及简 ...
- apache 多域名配置
一直不明白apache多域名配置的问题,所以只能用不同的端口来配置,现在终于搞懂了一点 首先,开启apache的vhost模块 找到配置文件httpd.conf中的下面两行 #LoadModule v ...
- 安装numpy/scipy/scikit-learn的方法
安装numpy 和 scipy sudo yum install lapack lapack-devel blas blas-devel sudo yum install numpy.x86_64 ...
- SDUT1574组合数的计算(组合数)
http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=1574 这个题,比较奇怪,是用递推去做的,我试了 ...
- poj 3101 Astronomy
2个星球周期为a,b.则相差半周的长度为a*b/(2*abs(a-b)),对于n个只需求这n个 分数的最小公倍数即可! 公式: 分数的最小公倍数 = 分子的最小公倍数/分母的最大公约数 由于涉及到大数 ...