博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
How can I add a new user as sudoer using the command line?
阅读量:4967 次
发布时间:2019-06-12

本文共 1560 字,大约阅读时间需要 5 分钟。

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 :

sudo adduser 
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.

转载于:https://www.cnblogs.com/rosepotato/p/3695254.html

你可能感兴趣的文章
64位UBUNTU下安装adobe reader后无法启动
查看>>
组件:slot插槽
查看>>
走进C++程序世界------异常处理
查看>>
Nginx配置文件nginx.conf中文详解(转)
查看>>
POJ 1308 Is It A Tree?(并查集)
查看>>
N进制到M进制的转换问题
查看>>
利用sed把一行的文本文件改成每句一行
查看>>
Android应用开发:核心技术解析与最佳实践pdf
查看>>
python——爬虫
查看>>
孤荷凌寒自学python第五十八天成功使用python来连接上远端MongoDb数据库
查看>>
求一个字符串中最长回文子串的长度(承接上一个题目)
查看>>
简单权限管理系统原理浅析
查看>>
springIOC第一个课堂案例的实现
查看>>
求输入成绩的平均分
查看>>
php PDO (转载)
查看>>
wordpress自动截取文章摘要代码
查看>>
[置顶] 一名优秀的程序设计师是如何管理知识的?
查看>>
scanf和gets
查看>>
highcharts 图表实例
查看>>
ubuntu下如何查看用户登录及系统授权相关信息
查看>>