Centos 7 学习之添加用户
2016-11-03 09:38
344 查看
http://blog.csdn.net/johnnycode/article/details/40655857
在使用 Centos 之前用的更多是Ubuntu,所以在 useradd 和 adduser 两条命令出现歧义,在Ubuntu系统上这是两条命令,而在Centos上则是同一条命令,adduser 是链接的形式存在
[plain] view
plain copy
# ll /usr/sbin/ | grep user
lrwxrwxrwx. 1 root root 7 10月 30 17:09 adduser -> useradd
-rwxr-x---. 1 root root 114064 6月 10 09:16 useradd
1、添加用户,Centos 没有任何交互动作!创建用户完毕后,必须修改密码否则无法登陆
[plain] view
plain copy
# useradd dev #创建用户
# passwd dev #修改密码
更改用户 dev 的密码 。
新的 密码:
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
2、为新建用户添加 sudo 权限,否则啥事都要请教 root 老大不合适,你懂得!
1)sudoers 文件添加可写权限
[plain] view
plain copy
# chmod -v u+w /etc/sudoers
"/etc/sudoers" 的权限模式保留为0640 (rw-r-----)
2)在 sudoers 文件添加新用户信息到 ## Allow root to run any commands anywher 下,修改后的效果为
[plain] view
plain copy
## Allow root to run any commands anywher
root ALL=(ALL) ALL
dev ALL=(ALL) ALL #新增用户信息
3)取消 sudoers 文件可写权限
[plain] view
plain copy
# chmod -v u-w /etc/sudoers
mode of "/etc/sudoers" changed from 0640 (rw-r-----) to 0440 (r--r-----)
在使用 Centos 之前用的更多是Ubuntu,所以在 useradd 和 adduser 两条命令出现歧义,在Ubuntu系统上这是两条命令,而在Centos上则是同一条命令,adduser 是链接的形式存在
[plain] view
plain copy
# ll /usr/sbin/ | grep user
lrwxrwxrwx. 1 root root 7 10月 30 17:09 adduser -> useradd
-rwxr-x---. 1 root root 114064 6月 10 09:16 useradd
1、添加用户,Centos 没有任何交互动作!创建用户完毕后,必须修改密码否则无法登陆
[plain] view
plain copy
# useradd dev #创建用户
# passwd dev #修改密码
更改用户 dev 的密码 。
新的 密码:
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
2、为新建用户添加 sudo 权限,否则啥事都要请教 root 老大不合适,你懂得!
1)sudoers 文件添加可写权限
[plain] view
plain copy
# chmod -v u+w /etc/sudoers
"/etc/sudoers" 的权限模式保留为0640 (rw-r-----)
2)在 sudoers 文件添加新用户信息到 ## Allow root to run any commands anywher 下,修改后的效果为
[plain] view
plain copy
## Allow root to run any commands anywher
root ALL=(ALL) ALL
dev ALL=(ALL) ALL #新增用户信息
3)取消 sudoers 文件可写权限
[plain] view
plain copy
# chmod -v u-w /etc/sudoers
mode of "/etc/sudoers" changed from 0640 (rw-r-----) to 0440 (r--r-----)
相关文章推荐
- Centos 7 学习之添加用户
- Centos 7 学习之添加用户
- Centos6.5学习之添加用户
- [Linux学习--用户管理]centos中添加一个新用户,并授权
- Centos7学习之添加用户和用户组的方法
- CentOS学习笔记之<添加用户到sudoers中>
- Sharepoint学习笔记—Ribbon系列-- 5. 在Ribbon中添加新控件(针对用户自定义Tab)
- centos 用户和组,权限,添加删除详解
- RedHat学习 linux用户管理命令(添加,删除,修改)
- Linux学习笔记——添加用户
- CentOS下添加Root权限用户的几种方法
- centos用户&组权限&添加删除用户问题总结
- ibatis学习之--4、添加用户的信息
- 【centreon学习1】添加普通用户并控制权限
- Centos学习笔记--linux用户管理
- maven学习七之用户密码修改和添加用户
- centos的用户、组权限、添加删除用户等操作的详细操作命令
- RedHat学习 linux用户管理命令(添加,删除,修改)
- centos将用户添加到sudo用户的方法
- Centos学习笔记--linux用户管理