Add multiple Users with the same passwd
#!/usr/bin/perl -w
use strict;
use Crypt::PasswdMD5;
# This will ask you for a password once all users will have the same passwd
print “Enter Password: “;
chomp ( my $Passwd = );
$cryptedPasswd = unix_md5_crypt($Passwd, $salt);
# Please create a file /root/username.txt that has all usenames
open(USERFILE, “< /root/username.txt”) || die “Cannot open username file: $!”;
my @users = < USERFILE >;
@users = sort(@users);
# Starting for loop to add users
foreach my $u (@users){
print “$u”;
my $cryptPasswd = “”;
my $salt = rand(99);
system(”useradd -m -d /home/$username $username”);
system(”usermod -p ‘$cryptedPasswd’ $username”);
print “Username is $u, using password hash $cryptedPasswd\n\n”;
}
close (USERFILE);
Sorry, the comment form is closed at this time.
-
Recent
- KDE remove autostart programs
- GPS on Linux
- Debian Squeeze change root password
- Download YouTube Videos on Linux
- Pidgin + The certificate for omega.contacts.msn.com could not be validated
- Tata Phonone / Reliance Netconnect (wvdial)
- mp3 on fedora-13
- Linux disk cache
- redhat/centos build kernel rpm
- KVM on centos5
- File Password Protection
- Building modules for rhel5 kernel
-
Links
-
Archives
- November 2011 (1)
- July 2011 (1)
- April 2011 (1)
- January 2011 (1)
- November 2010 (1)
- September 2010 (2)
- July 2010 (3)
- March 2010 (1)
- January 2010 (5)
- December 2009 (1)
- April 2009 (1)
- January 2009 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS