I have a list of over 40 students, that I want to add as users to my Ubuntu server. I do not wantto do “adduser” for each of them separately. Is there an easy way to add all of them at once? For example, can I create a CSV file with usernames and passwords, and create a username for each row of the file?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hi @erel,
You can create a list of users and passwords and then use a small bash script to go through them.
Let’s assume the list looks like this:
Your bash script will look like:
To create the script, ssh to your Droplet, create a file called
createusers.sh
and put the above contents in it. Additionally, don’t forget to create thestudentusers
file in your/root
directory.Once that is done, just execute the following
sudo bash createusers.sh
That should do the trick.
Hello @erel
What I can add as an idea is to use random passwords for the usernames and not re-using the same password or just changing the last digit, as in my experience students usually tend to abuse a system during exams and are often able to find the pattern in the username/password generation.
Regards