Centos7 添加用户及设置权限
2024-10-19 19:39:19
一、添加用户
- 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
最新文章
- JavaScript 属性类型(数据属性和访问器属性)
- This build of Sublime Text 2 has expired
- Linux high memory 学习总结
- The resource could not be loaded because the App Transport Security policy requires the use of a secure connection
- RPI学习--WebCam_mplayer
- google base库中的WaitableEvent
- 《剑指offer》— JavaScript(1)二维数组中的查找
- FineReport调用存储过程
- Python中的变量类型
- 2018-2019-2 20165232《网络对抗技术》Exp1 缓冲区溢出实验
- Django—常用功能
- [BOI2007]Mokia 摩基亚
- Java进阶之JDBC
- 关于windows2008r2系统80端口被system进程占用的问题
- main.js_vue
- javascript: 数组详细操作方法及解析合集(9个改变8个不变12个遍历)
- 一个简单的二叉搜索树(C++实现)
- 好的 IOS 学习网站
- nw 调用系统命令
- 搭建github博客,hexo主题
热门文章
- layui的基本使用
- Spring笔记(9) - IOC实现方式详解
- tep用户手册帮你从unittest过渡到pytest
- HCIP --- BGP实验
- 小题大做 | Handler内存泄露全面分析
- 解决[BScroll warn]: Can not resolve the wrapper DOM. Vue better-scroll
- [LeetCode]60. Permutation Sequence求全排列第k个
- 一次失败的java Box居中尝试
- Java学习日报7.13
- stm32之定时器彻底研究