LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
Search this Thread
Old 02-07-2010, 05:06 PM   #1
dranach
LQ Newbie
 
Registered: Oct 2009
Location: vlaanderen
Distribution: debian, sometimes sprinkled with a touch of fluxbox; ubuntu on occasion,
Posts: 14

Rep: Reputation: 0
add users with a standard password


I have to add my students as a user to a class-server to have them work on some TCP/IP-related questions. The server is Debian Lenny.

It would be easy if I could make some kind of script to add them, even with a standard password like 'abc123'. I want to show them the way FTP uses clear-text passwords as opposed to SFTP. Or the differences between telnet and ssh.

I know something about scripting with bash, but how can I add the same standard password to each user, without having to type it for everyone?

Thanks,
Toni
 
Old 02-07-2010, 06:20 PM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
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.
 
  


Reply

Tags
administration, debian, user


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] standard layout or add in all the extras rjo98 Linux - Newbie 4 09-04-2009 11:41 AM
Script to Auto-add Domain Users to Workstation Power Users Group doesn't work avinash.rao Ubuntu 0 08-22-2009 05:57 AM
Script to add a secondary group to all users except system default users Tekken Linux - Server 5 06-29-2009 05:02 PM
Cannot change root password (let alone standard user's password) jbottiger Red Hat 4 01-06-2009 09:03 PM
Add Remove Programs GUI for more than just standard packages? jimdaworm Linux - Newbie 9 08-26-2003 06:38 PM


All times are GMT -5. The time now is 10:25 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration