One way could be to add one student with that password, and then create the lines to add to /etc/passwd and /etc/shadow.
Code:
~> cat students
john
sally
pete
chuck
charly
simon
paste -d: students <(seq 1001 1006) <(seq 1001 1006) |
sed 's/^\([[:alpha:]][[:alpha:]]*\):\([[:digit:]]*:[[:digit:]]*\)$/\1:\2:\1:\/home\/\1:\/bin\/bash/' >students_passwd
john:1001:1001:john:/home/john:/bin/bash
sally:1002:1002:sally:/home/sally:/bin/bash
pete:1003:1003:pete:/home/pete:/bin/bash
chuck:1004:1004:chuck:/home/chuck:/bin/bash
charly:1005:1005:charly:/home/charly:/bin/bash
simon:1006:1006:simon:/home/simon:/bin/bash
Then in an editor, insert students_passwd into the /etc/passwd file. Using the "vipw" program you would type the vim command :r student_passwd
Code:
sed 's#.*#&:$2a$10$abcdefghlghalaslladklfjalkfalskf:14597:0:99999:7:::#' students >students_shadow
In this sed command, everything after s#.*#&: except for the last # is copied from the sample entry.
Make sure you make copies of the original /etc/passwd and /etc/shadow.