Howto: Linux Add User To Group -- 再次无语国内转帖抄袭之风

16 篇文章 0 订阅
2 篇文章 0 订阅

将用户添加到组,包括未建立的用户,和已存在的用户添加到组的,都有..

 

在这里再次鄙视一些盲目无耻的人,动不动就是社区里,wiki里写的明明白白的你自己去找的这种人..

还有那些自己没有搞懂的,却又要装B往上乱贴内容的人,比垃圾更垃圾,误人子弟...


为了找下usermod的使用,国内的基本上就不知道是转哪里的帖子,都是一模一样的,连字都不带变的...还是原创,妈妈的

同样一个帖子N个原创作者... 无语..

 

你说你贴也就贴了,好歹你尝试下,六个正确的例子上边吧... 我用中文在过哦讴歌了里面搜 linux将用户贴加到组

基本就不带有正确的,难不成发的都是高手,把读者都当成大鸡了么?

然后在google里面使用关键字 how to add user to group in linux 一下就可以找到这篇帖子... 无语...

 

再说依据,希望各位大大发帖子,尤其是代码和程序使用,请留个例子或者什么可看到的东西,可以么??

 

今天在javaeye看到一个帖子,使用java判断汉字属于哪种字符集,很无语问下,各位都是大大的高手啊,你们写代码都不用注释么?? 不给注视你就别往上贴.... 你以为我是你肚子里的蛔虫,跟你想法一样么??

写程序,写清楚注释,遵循编码规范.......

 

 

写道
Q. How can I add a user to a group under Linux operating system?

A. You can use useradd or usermod commands to add a user to a group. useradd command creates a new user or update default new user information. usermod command modifies a user account i.e. it is useful to add user to existing group. There are two types of group. First is primary user group and other is secondary group. All user account related information is stored in /etc/passwd, /etc/shadow and /etc/group files to store user information.

useradd example - Add a new user to secondary group
Use useradd command to add new users to existing group (or create a new group and then add user). If group does not exist, create it. Syntax:

useradd -G {group-name} username

Create a new user called vivek and add it to group called developers. First login as a root user (make sure group developers exists), enter:

# grep developers /etc/group

Output:

developers:x:1124:If you do not see any output then you need to add group developers using groupadd command:

# groupadd developers

Next, add a user called vivek to group developers:

# useradd -G developers vivek

Setup password for user vivek:

# passwd vivek

Ensure that user added properly to group developers:

# id vivek
Output:

uid=1122(vivek) gid=1125(vivek) groups=1125(vivek),1124(developers)Please note that capital G (-G) option add user to a list of supplementary groups. Each group is separated from the next by a comma, with no intervening whitespace. For example, add user jerry to groups admins, ftp, www, and developers, enter:

# useradd -G admins,ftp,www,developers jerry

useradd example - Add a new user to primary group
To add a user tony to group developers use following command:

# useradd -g developers tony
# id tony

uid=1123(tony) gid=1124(developers) groups=1124(developers)

Please note that small -g option add user to initial login group (primary group). The group name must exist. A group number must refer to an already existing group.

usermod example - Add a existing user to existing group
Add existing user tony to ftp supplementary/secondary group with usermod command using -a option ~ i.e. add the user to the supplemental group(s). Use only with -G option :

# usermod -a -G ftp tony
Change existing user tony primary group to www:

# usermod -g www tony

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值