Urgent help in scripting to create multiple user account in suse linux
SUSE / openSUSEThis Forum is for the discussion of Suse Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Urgent help in scripting to create multiple user account in suse linux
Hi people, i'm in need of serious help asap in regard of creating multiple user account like for example of 100 user account using loops in a script to create. Can anyone help me asap. Thanks.
for example something like this, would be able to work am i right ? In this case the password after that should i go yast and set something on it, but end of the day i just hope to know if this above code do really work, thanks
There's some good stuff about shell scripting, among other things, at linuxcommand.org so read there if you are unsure about commands. Basically to add a user to the system you can use ready scripts (can be tricky to script to use a script to add the user) or just modify three files: /etc/passwd, /etc/shadow and /etc/group (first one: user information, NO password, second: encrypted password and some information, third: group information). The syntax in the files is important. Basically to add users you'll have to add new lines to the files (easy) with two or three fields edited, the others may remain as they are (days before password expiration, days after Epoch, ...) If you know the syntax it should be easy enough, and the syntax can be obtained from manpages for example (man /etc/passwd). Passwords are set after this, using passwd for example, but that's another thing. I'm not sure if some of the Big distributions handle users in a complex way today, they shouldn't, but then again init scripts are handled in a complex way often (except in Slackware). If everything is all right, you should be able to easily script something that alters the three files and adds the users. For gods sake, first test it with one and not 100 accounts, and better yet don't use the original files at first, but do it with some testfiles like ~/passwd, ~/shadow, ~/group to see the effects.
I too doubt if anyone is willing to write the script for you (I would, if I had time heh) but surely you'll get help if you ask. If you have a partially ready or started-out script, post it here if you like, you'll get comments and suggestions.
For gods sake, first test it with one and not 100 accounts, and better yet don't use the original files at first, but do it with some testfiles like ~/passwd, ~/shadow, ~/group to see the effects.
Do you have the list of usernames/passwords in a file? If so, check whether you have the newusers command installed - the man page gives details on using it.
ar sorry guys i was busy with other project for the past few days thus unable to reply, anyway is there any sites you guys can intro me for me to learn more about adding this 1 to 100 users thing, because i also need to know how to set them into the correct groups and add password to each user, urgent help needed please guide me guys, would be very grateful about it.
i do have all the user in a single file, but i think is that i tried to run that more than once then the system tells me that the file already existed or something like that, but right now the problem is that i need to know more than that, i need to know how to set password for each user also, can anyone give me a better idea about it ?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.