How to quickly add a large number of users and user groups

Source: Internet
Author: User
Tags ftp login in domain microsoft help

Windows

Assume that Domain A and Domain B are built, and the two have established a trust relationship. You can add users or user groups in their respective domains by entering the following command in the command line:

1. Add User Groups
For/L % I in (1, 1, 10) Do dsadd group Cn = DN-GRP % I, Cn = users, Dc = domaina, dc = com-sergyes-scope L (Windows2003)

For/L % I in (, 5) Do net group dn1-grp % I/Add (Windows2000)

2. Add User in Domain
For/L % I in (1, 1, 10) Do dsadd user Cn = DN-user % I, Cn = users, Dc = domaina, dc = com-PWD password-disabled no (Windows2003)

For/L % I in (, 5) Do net user dn1-user % I password/Add (Windows2000)

Note: The results will create 10 new user groups/users named dn-grp1/dn-user1, dn-grp2/dn-user2..., and so on. For more information about the parameters, see Microsoft Help.

3. Add the user group of Domain B to the DC of Domain.
Login With administrator@domainB.com on DC of Domain
Run "for/L % I in (1, 1, 5) Do dsadd group Cn = mygroup % I, ou = wesoft1, Dc = Bill-testing, dc = com-sergyes-scope l "command

3. Add the user to the user group of Domain B on the DC of Domain.

Method not found.
The reason is that dsadd and dsmod commands are not successful because "when two forests are connected through forest trust, dsmod does not support adding security subjects in one forest to groups in another domain. You can use the "Active Directory users and computers" snap-in to add security subjects across forest trust relationships. "
From-http://www.microsoft.com/technet/prodtechnol/windowsserver2003/zh-chs/library/ServerHelp/3558c421-ba3d-4b8f-a107-b9058cc0f286.mspx? MFR = true

On Unix/Linux platforms

Add User

1. Create userfile.txt, a file containing the new user, and userpwdfile.txt, which sets the password for the new user;
[Root @ localhost ~] # Touch userfile.txt
[Root @ localhost ~] # Touch userpwdfile.txt
Then, open the userfile.txt file with the Administrative editor and add the following content;
Win00: X: 520: 520:/home/win00:/sbin/nologin
Win01: X: 521: 521:/home/win01:/sbin/nologin
Win02: X: 522: 522:/home/win02:/sbin/nologin
Win03: X: 523: 523:/home/win03:/sbin/nologin
Win04: X: 524: 524:/home/win04:/sbin/nologin
Win05: X: 525: 525:/home/win05:/sbin/nologin
Win06: X: 526: 526:/home/win06:/sbin/nologin
Win07: X: 527: 527:/home/win07:/sbin/nologin
Win08: X: 528: 528:/home/win08:/sbin/nologin
Win09: X: 529: 529:/home/win09:/sbin/nologin

The content format of the userfile.txt file is the same as that of/etc/passwd, which must be written in strict accordance with the/etc/passwd format. All users added above cannot log on to the system, but it can be used for FTP login, but you have to open it in the configuration file of the corresponding FTP server to allow local users to have read and write permissions; if you want to allow some of the above users to log on to the system, you can change the shell like/bin/bash;
Password File userpwdfile.txt; the user name in the file must be the same as the userfile.txt user name; that is to say, we first add the user win00 to win09, and now we want to update the password for these users; for example, the following;
Win 00: 123456
Win01: 654321
Win02: 123321.
Win03: qweewq
Win04: Google
Win05: adadwc
Win06: wsscee
Win07: xxec32
Win08: 543wew
Win09: 3ce3wf

2. Add users in batches through newusers and chpasswd;
[Root @ localhost ~] # Newusers userfile.txt
[Root @ localhost ~] # Chpasswd <userpwdfile.txt
In this case, if you find that the user's clear password can be found in/etc/passwd, you can use the following command to map to the/etc/shadow file name;
[Root @ localhost ~] # Pwconv

This part comes from: http://www.linuxsir.org/main? Q = node/109

Add User Group

The command is simple, that is, groupadd [user group name], which can be programmed using shell.

For example

For I in 1 2 3 4 5 or cat file | while read line

Do

Groupadd GRP $ I

Done

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.