Created
March 11, 2016 01:40
-
-
Save morris821028/4e99220726a9221cd97e to your computer and use it in GitHub Desktop.
TA work: add student account on server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
student = open('students') | |
for line in student.readlines(): | |
line = line[:-1] | |
print line | |
cmd = "useradd -m -s /bin/bash -d /home/pp2016/%s %s" % (line, line) | |
psw = "echo %s:%s | chpasswd" % (line, line) | |
print cmd | |
print psw | |
# assert os.system(cmd) == 0 | |
# assert os.system(psw) == 0 | |
bash = "chsh -s /bin/bash %s" % line | |
print bash | |
assert os.system(bash) == 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
B01505025 | |
B01505026 | |
B02902062 | |
B02902087 | |
B02902091 | |
B01902027 | |
B01902059 | |
B01902103 | |
R03921053 | |
R04922067 | |
R04922075 | |
R04922080 | |
R04922106 | |
R04922133 | |
R04944035 | |
60447007S |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment