Linux下用户/组的管理

对于Linux下用户/组的管理机制,以前有个大概的认识,没有进行相关方面的实际操作。今天怀疑一个执行命令的问题是因为sudo产生的,就对这方面的知识进行了学习。

[b]Linux 用户(user)和用户组(group)管理概述[/b]
[url]http://fedora.linuxsir.org/main/?q=node/91[/url]

[b]useradd和groupadd的简单实例[/b]
# groupadd -g 102 test
# useradd -u 1003 -g 102 -d /home/test1 -s /bin/bash \
-c "Test 1" -m -k /etc/skel test1


[b]给test1用户sudo权限[/b]
# chmod u+w /etc/sudoers
# vi /etc/sudoers
## Next comes the main part: which users can run what software on
## which machines (the sudoers file can be shared between multiple
## systems).
## Syntax:
##
## user MACHINE=COMMANDS
##
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
test1 ALL=(ALL) ALL # 执行sudo命令时需要输入密码
# test1 ALL=NOPASSWD: ALL # 不需要输入密码
## Allows members of the 'sys' group to run networking, software,
## service management apps and more.
# %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS

## Allows people in group wheel to run all commands
# %wheel ALL=(ALL) ALL

## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值