Can you verify my syntax for creating multiple users in a batch file?
I have been researching this for days now. I've been to some other forums and been put down for asking. Sorry, I am new and haven't read every single man page available yet. *sigh* I had a moderator at another website tell me that I shouldn't expect help for some random script I pulled out of the darkness of the internet.
I asked about the linux command "newusers".
Specifically, I asked if it would do what I need it to do, and if my syntax was right, and if there was anything else I might need to use to accomplish my goal.
I posted all the info about the commands I thought were right, but needed verified. I will post the info here, and hopefully someone will be kind to this newbie and give me some helpful advice rather than unhelpful put-downs. :(
I had an old win2kpro system with about 300 user accounts. The drive died. So I couldn't export the accounts, they're all lost. I am setting the new system up with suse 11.3, as that's what I use at home on my personal system. However, my dealings with linux have ONLY been on my personal system, so I haven't had the need to create that many accounts on one box before. So I started researching a tool or script or something that would help. I found "newusers".
Also, I noted when creating a single new user thru YAST, it adds the user both to "users" and to "video" groups. So my other question, besides just adding the users in bulk, is whether the commands below will add them to both users AND video? Or will I have to find a way to separately add them to "video"?
What I found so far was that I should do this:
(chmod the batch-user-add.txt file)
# touch /root/batch-user-add.txt
# chmod 0600 /root/batch-user-add.txt
(open the batch-user-add.txt file to edit it)
# vi /root/batch-user-add.txt
(add the following into the batch-user-add.txt file)
# newusers /root/batch-user-add.txt
I didn't find it somewhere in the dark on the internet. newusers is a linux command. I found the info about how to use it between the man pages and various bulletin board posts which have bits and pieces of it, but so many of them have variations on the above commands, so I'm not sure if I've got it right or not. So I am trying to follow the directions between that and the linked man pages of passwd and other related commands, and am trying to find out if it will
A) do what I need it to do,
and B) if I've got the syntax right.
I don't know how many other ways I can word my questions? I know I'm new to all this, but I HAVE been doing my homework and reading for days now, both man pages and bulletin boards, and articles, and the specific documentation that came with my installation, and trying to ask intelligent questions.
I'm getting discouraged with this and about ready to go back to windoze just to get this computer up and running before the 300 residents of this building throw a fit. I'm very frustrated, and kinda sad about the level of unfriendliness and unhelpfulness I've encountered among the linux "experts". This is pretty much my last try at hoping someone might actually help?
While I appreciate your frustration, adding several paragraphs detailing the many unhelpful people you've met doesn't help us help you ;) and can come across perhaps differently to the way you intended it to.
I believe your format is correct for your input file. And what it should do is create a user from each of the lines, according to the information you've given it and the information you get when you type 'man newusers'. I don't think that they will be added to the 'video' group:
So if you already have a group #1001, then they will be added to that; if not, it will be named 'Unit0106' and they will all be added to it. In order to add them to the 'video' group, I've written you a nice little script:
Hope this helps,
I know. I apologize. I was incredibly frustrated. :(
Thank you for your advice on this. Do I type each line of that on its own line (hitting return after each?) or do I enter it all on one line?
Also, a question on my input file. It says gid or group id, so is that referring to the group name (ie "users") or the group number (ie "1001") I just want to be very sure before I run this file and create 300+ accounts. :)
Thank you again! :)
where is newusers?
Which versions of linux contain newusers by default? And is there a way to add it if it's not included by default?
Tell us which distro you are using; in fact, add it to your profile so we don't need to ask again next time.
Login as root and run
If you have an rpm based distro eg RHEL, Centos, Fedora etc, you can also try
EDIT: Rereading the man-page you can actually use the group name as well... So either should work :)
|All times are GMT -5. The time now is 12:57 AM.|