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
- Set Time Zone + Fedora 18
- Fedora 17 + Tata Photon (Huawei)
- Fedora 17: Install OpenSSH Server
- Change the default keyring password
- Error: Could not stat() command file ‘/usr/local/nagios/var/rw/nagios.cmd’!
- Gnone 3.X adding personal launcher
- Gnome 3.x Change Panel
- 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
-
Links
-
Archives
- April 2013 (1)
- September 2012 (2)
- August 2012 (2)
- July 2012 (2)
- November 2011 (1)
- July 2011 (1)
- April 2011 (1)
- January 2011 (1)
- November 2010 (1)
- September 2010 (2)
- July 2010 (3)
- March 2010 (1)
-
Categories
-
RSS
Entries RSS
Comments RSS