为什么80%的码农都做不了架构师?>>>   

mahao@ms:~$ sudo mkdir soft
[sudo] password for mahao: 
mahao is not in the sudoers file.  This incident will be reported.

切换到root用户

mahao@ms:~$ su root
Password:
root@ms:
root@ms:~# visudo

GNU nano 2.5.3                                                                           File: /etc/sudoers.tmp

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL

mahao(你要赋予权限的用户名) ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

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

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

[ Read 31 lines ]
^G Get Help       ^O Write Out      ^W Where Is       ^K Cut Text       ^J Justify

^C Cur Pos        ^Y Prev Page      M-\ First Line    M-W WhereIs Next  ^^ Mark Text

M-} Indent Text   M-U Undo          ^B Back           M-Space Prev Word ^A Home
^X Exit           ^R Read File      ^\ Replace        ^U Uncut Text     ^T To Spell

^_ Go To Line     ^V Next Page      M-/ Last Line     M-] To Bracket    M-^ Copy Text

M-{ Unindent Text M-E Redo          ^F Forward        ^Space Next Word  ^E End

添加了红色一行。

按ctrl+o保存

File Name to Write: /etc/sudoers.tmp                                                                                                                                                                                                                                          
^G Get Help                                           M-D DOS Format                                        M-A Append                                            M-B Backup File
^C Cancel                                             M-M Mac Format                                        M-P Prepend                                           ^T To Files

直接回车

按ctrl+x退出

然后切换用户,执行sudo

root@ms:/home/mahao# su mahao
mahao@ms:~$ sudo mkdir soft
[sudo] password for mahao:
mahao@ms:~$

就OK了。

转载于:https://my.oschina.net/marhal/blog/1577233

Linux 给用户添加sudo权限相关推荐

  1. linux为用户添加sudo权限

    用sudo时提示"xxx is not in the sudoers file. This incident will be reported.其中XXX是你的用户名,也就是你的用户名没有权 ...

  2. Linux给用户添加sudo权限

    linux下,一般用户运行sudo命令时会出现错误提示:  如vurtne is not in the sudoers file.  This incident will be reported.  ...

  3. centos给用户添加sudo权限

    linux给用户添加sudo权限: 有时候,linux下面运行sudo命令,会提示类似: xxxis not in the sudoers file. This incident will be re ...

  4. Linux 用户添加sudo权限

    Linux 用户添加sudo权限 一:切换到root用户 二:修改sudoers文件的权限.默认只有readonly权限 三:利用vim命令修改sudoers文件 一:切换到root用户 su roo ...

  5. linux7基础——给用户添加sudo权限

    文章目录 1. 切换到超级用户 2. 修改sudoers文件内容 1. 切换到超级用户 命令:su 密码:******** 此处的密码是root用户的密码 2. 修改sudoers文件内容 默认的su ...

  6. linux如何给用户加sudo权限,如何在Linux环境为用户添加sudo权限

    sudo的配置文件 sudo默认配置文件是**/etc/sudoers** ,一般使用Linux指定编辑工具visudo ,此工具的好处是可以进行错误检查.在添加规则不符合语法规则时,保存退出时会提示 ...

  7. Linux环境下为普通用户添加sudo权限

    1.背景: sudo是Linux系统管理指令,是允许系统管理员让普通用户执行一些或者全部root命令的一个工具.Linux系统下,为了安全,一般来说我们操作都是在普通用户下操作,但是有时候普通用户需要 ...

  8. Ubuntu 给用户添加sudo权限

    前言 有时需要使用 root 权限,比如安装软件.启动服务等操作时就需要用到 sudo 命令来提升权限才能进行操作.而新添加的普通用户是没有权限进行 sudo 操作的,所以我们需要对普通用户授予 su ...

  9. Ubuntu 为普通用户添加sudo权限

    sudo是linux下常用的允许普通用户使用超级用户权限的工具.在需要超级用户权限时前面加上sudo,比如: sudo vim /xxxxxxxxxx,然后系统提示输入密码,正确后就可以像root一样 ...

最新文章

  1. 【pytorch】StatScores的原理与使用
  2. 洛谷P2587 [ZJOI2008] 泡泡堂
  3. 地雷会炸到自己吗_回顾自己曾经的往事 ——记双语学习有感
  4. linux管道和tee命令
  5. java8: hashmap性能提升
  6. UNIX环境高级编程之第5章:标准I/O库
  7. WCF中加密数据信息
  8. 免费版本的mysql与收费版本的区别
  9. 集成应用|契约锁与100+管理软件实现集成应用
  10. QQ音乐(15.9.0)去广告绿色版
  11. python与vfp做桌面数据库_Python:如何提高将数据从vfp(dbf)加载到oracle的效率?...
  12. 如何打开后缀为.xps的文件?
  13. wps软件打不开共享超链接_ppt超链接文件打不开,wps的ppt超链接打不开
  14. VR和AR将如何发展下去?哪个更有前景?
  15. python学生管理系统设计实验报告_学生成绩管理系统实验报告(新鲜出炉)
  16. omap3630 linux i2c总线驱动分析,OMAP3630 Linux I2C总线驱动分析
  17. 关于89 jb2上的自动设置按键唤醒系统的功能以及L版本上设置唤醒键
  18. html----四种“返回按钮”的使用
  19. PL-SLAM 配置和测试
  20. 超过 25 个华丽的 Web 日历组件【多图慎入】

热门文章

  1. jQuery对象与DOM对象的区别
  2. js按照指定月份确认该月的开始时间和结束时间
  3. java对日期进行加减操作以及比较大小
  4. Icon class生成器(Python)
  5. SLAM:ORB-SLAM 位姿优化描述
  6. C++ 专题:陈皓:Why C++? 王者归来
  7. ML二:python批量修改文件名-测试KDTree
  8. OpenCV: kalman滤波的代码段
  9. 为什么map对象不能使用stl中的sort函数
  10. 2018/8/9 MultiU 6 并查集+dfs,反向建边提高查询效率 !!! / 最大字段和n维(降维)/ 状压+中途相遇法...