Thursday, September 10, 2009

Create Users And Change Passwords With A Bash Script

These two scripts are very important for the system admin who regularly works with mail servers and somehow forgets to backup his system username and password! Let’s say somehow we lost the usernames and passwords of the mail server. In this case the admin has to manually create all the users and then change the passwords for all the users. Tedious job. Let’s make our life easier.
First create a file which contains all the user name. Something like this:
nurealam
nayeem
mrahman
farid
rubi
sankar
Save the file as userlist.txt. Now create the following bash file:
#!/bin/sh
for i in `more userlist.txt `
do
echo $i
adduser $i
done
Save the file and exit.
chmod 755 userlist.txt
Now run the file:
./userlist.txt
This will add all the users to the system. Now we have to change the passwords. Let's say we want username123 as password. So for user nayeem the password will be nayeem123, rubi123 for user rubi and so on.
Create another bash file as follows:
#!/bin/sh
for i in `more userlist.txt `
do
echo $i
echo $i"123" | passwd –-stdin "$i"
echo; echo "User $username’s password changed!"
done
Run the file. All the passwords are changed.

Network Monitoring With ntop

ntop is a network traffic tools that shows network usage in a real time. One of the good things about this tool is that you can use a web browser to manage and navigate through ntop traffic information to better understand network status.
Also Ntop monitors and reports hosts traffic and supports these protocols:
  • TCP/UDP/ICMP
  • (R)ARP
  • IPX
  • DLC
  • Decnet
  • AppleTalk
  • Netbios
  • TCP/UDP
In this tutorial we'll install ntop 3.2 in CentOS 4.


Prerequisites


Ntop 3.2
LIBPCAP
GDBM


Links

http://dag.wieers.com/rpm/packages/ntop
http://rpmfind.net/linux/RPM/fedora/4/i386/glib-1.2.10-16.i386.html

Installation
1- Installing G-LIB:
rpm -ivh  glib-1.2.10-16.i386.rpm

2- Installing ntop:
rpm -ivh ntop-3.2-1.el4.rf.i386.rpm


Running ntop
1- Initialize ntop:
  #ntop
That will initialize ntop and it will ask you to enter your username and password.
The default username: admin
Password: yourEnteredpassword
2- Start ntop service:
#service ntop start


Log In To The Web Interfacentop can be managed through a web interface. You can enter your server address in your web browser:
http://ServerIP:3000
https://ServerIP:3001 
Now you can monitor your hosts and manage your ntop configuration.

Screenshot

Ntop SC

How To Block Ads And Banners In SafeSquid Proxy Server

This summary is not available. Please click here to view the post.