Bash Script

creating user accounts from file

Page 1 of 1

1 Replies - 1091 Views - Last Post: 03 December 2010 - 11:37 AM Rate Topic: -----

#1 FifoK   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 16-November 09

Bash Script

Posted 03 December 2010 - 11:26 AM

Hi there I'm simulating hosting server and I have a question. I have a file called Users.txt and when a user registers this file is appended in the following format - $username:$password . So my goal is to create bash script that reads the file line by line and adds the new Linux users. The code also needs to create a home directory for each user.

So this is what I got by now but something is missing...
for entry in `cat /home/student/public_html/Users.txt`
	for i in &entry
		useradd $i -p #I'm not sure how to include the $password here...

Thank you for your help!

Is This A Good Question/Topic? 0
  • +

Replies To: Bash Script

#2 JackOfAllTrades   User is offline

  • Saucy!
  • member icon

Reputation: 6246
  • View blog
  • Posts: 24,014
  • Joined: 23-August 08

Re: Bash Script

Posted 03 December 2010 - 11:37 AM

There is no PHP content in this, so I'm going to change the title and move this to Other Languages.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1