一、添加用户

  • 1、登录root 用户

[gau@localhost /]$ su
Password: # 输入密码
[root@localhost /]#
  • 2、添加用户
[root@localhost /]# useradd testuser
[root@localhost /]#
  • 3、设置用户密码
[root@localhost /]# passwd testuser
Changing password for user testuser.
New password:
BAD PASSWORD: The password is a palindrome
Retype new password:
passwd: all authentication tokens updated successfully.
[root@localhost /]#

二、给该用户添加root权限

  • 1、切换到root(#su)

  • 2、#chmod -v u+w /etc/sudoers 为sudoers添加可写权限

  • 3、输入vi sudoers,进入命令模式,按Insert,进入编辑模式

  • 4、在 sudoers 文件添加新用户信息到 ## Allow root to run any commands anywhere 下,修改后的效果为

## Allow root to run any commands anywher

      root   ALL=(ALL)    ALL

      xxx    ALL=(ALL)    ALL #xxx为新增用户

  • 5、保存:按Esc 后 输入 :wq 保存并退出

  • 6、取消 sudoers 文件可写权限     # chmod -v u-w /etc/sudoers

三、测试

1、普通用户进入

2、#sudo mkdir test(创建的文件夹名)

3、#ls 查看目录

4、#sudo rm -r test ( 删除文件夹)

————————————————

版权声明:本文为CSDN博主「喜欢海呀」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。

原文链接:https://blog.csdn.net/qq_25046261/article/details/78182536

最新文章

  1. JavaScript 属性类型(数据属性和访问器属性)
  2. This build of Sublime Text 2 has expired
  3. Linux high memory 学习总结
  4. The resource could not be loaded because the App Transport Security policy requires the use of a secure connection
  5. RPI学习--WebCam_mplayer
  6. google base库中的WaitableEvent
  7. 《剑指offer》— JavaScript(1)二维数组中的查找
  8. FineReport调用存储过程
  9. Python中的变量类型
  10. 2018-2019-2 20165232《网络对抗技术》Exp1 缓冲区溢出实验
  11. Django—常用功能
  12. [BOI2007]Mokia 摩基亚
  13. Java进阶之JDBC
  14. 关于windows2008r2系统80端口被system进程占用的问题
  15. main.js_vue
  16. javascript: 数组详细操作方法及解析合集(9个改变8个不变12个遍历)
  17. 一个简单的二叉搜索树(C++实现)
  18. 好的 IOS 学习网站
  19. nw 调用系统命令
  20. 搭建github博客,hexo主题

热门文章

  1. layui的基本使用
  2. Spring笔记(9) - IOC实现方式详解
  3. tep用户手册帮你从unittest过渡到pytest
  4. HCIP --- BGP实验
  5. 小题大做 | Handler内存泄露全面分析
  6. 解决[BScroll warn]: Can not resolve the wrapper DOM. Vue better-scroll
  7. [LeetCode]60. Permutation Sequence求全排列第k个
  8. 一次失败的java Box居中尝试
  9. Java学习日报7.13
  10. stm32之定时器彻底研究