To kill all process of logged in user and logout
pkill -KILL -u username
Saturday, October 3, 2009
Ethernet Loopback connector
Occasionally I need for a network card to operate as a live network connection, without it actually being connected to a network. Typically for testing purposes, I need a quick and easy way to make a loopback connector. Small enough to keep in my Pocket. The following is a quick "how to" for making an Ethernet loopback connector.
To create a loopback plug, cross pin 1 (TX+) and pin 3 (RX+) together, and cross pin 2 (TX-) and pin 6 (RX-) together. You need the following equipment to create the loopback:
When you create and then test a physical loopback, you are testing the RJ-45 interface of the NIC.
To create a loopback plug, cross pin 1 (TX+) and pin 3 (RX+) together, and cross pin 2 (TX-) and pin 6 (RX-) together. You need the following equipment to create the loopback:
- A 6-inch long CAT5 cable
- An RJ-45 connector
- A crimping tool
When you create and then test a physical loopback, you are testing the RJ-45 interface of the NIC.
Know Number of Logged in User in FreeRadius from Shell
This is a very useful perl script that i created to know how many user are logged in on FreeRadius from the UNIX/Linux shell or command line.
It’s for FreeRadius with MySQL and I think it is usefull for other radiuses as well.
Below is the full code.
#!/usr/bin/perl -w
use DBI;
my $db = 'radius';
my $db_host = 'localhost';
my $db_username = 'username';
my $db_password = 'password';
my $dbh = DBI->connect("dbi:mysql:database=$db;host=$db_host:port number;user=$db_username;password=$db_password") or die "Couldn't connect to database: $DBI::errstr\n";
my $sql = qq{SELECT DISTINCT UserName,AcctStartTime,FramedIPAddress,CallingStationId FROM radacct WHERE AcctStopTime = '0000-00-00 00:00:00' AND NASIPAddress = '192.168.254.2' GROUP BY UserName};
$sth = $dbh->prepare($sql) or die "Couldn't prepare query '$sql': $DBI::errstr\n";
$sth->execute() or die "Couldn't execute query '$sql': $DBI::errstr\n";
print $sth->rows();
$sth->finish();
$dbh->disconnect();
exit;
Note:
change the username and password to actual username and password of a MySQL database, and NASIPAddress.
It’s for FreeRadius with MySQL and I think it is usefull for other radiuses as well.
Below is the full code.
#!/usr/bin/perl -w
use DBI;
my $db = 'radius';
my $db_host = 'localhost';
my $db_username = 'username';
my $db_password = 'password';
my $dbh = DBI->connect("dbi:mysql:database=$db;host=$db_host:port number;user=$db_username;password=$db_password") or die "Couldn't connect to database: $DBI::errstr\n";
my $sql = qq{SELECT DISTINCT UserName,AcctStartTime,FramedIPAddress,CallingStationId FROM radacct WHERE AcctStopTime = '0000-00-00 00:00:00' AND NASIPAddress = '192.168.254.2' GROUP BY UserName};
$sth = $dbh->prepare($sql) or die "Couldn't prepare query '$sql': $DBI::errstr\n";
$sth->execute() or die "Couldn't execute query '$sql': $DBI::errstr\n";
print $sth->rows();
$sth->finish();
$dbh->disconnect();
exit;
Note:
change the username and password to actual username and password of a MySQL database, and NASIPAddress.
MacJournal to WordPress
You can publish your MacJournal to WordPress.
(For custom configuration.)
(For custom configuration.)
Here’s the step-by-step guide:
1. Select your desired journal entry.
2. From the menu Entry, click Send to Blog.
3. Click Manual Setup
4. Type in Name : (your blog name)
5. In pull down menu,Type: select Movable Type
6. Type in URL: http://yourname.wordpress.com/
7. Type in Post URL: http://yourname.wordpress.com/xmlrpc.php
8. Type in Username : (your account name)
9. Type in Blog ID : 1
10. Press button Ok.
Monday, April 20, 2009
FreeBSD VLANs Configuration using ifconfig command
To create a new VLAN interface, enter:
# ifconfig {vlan-name} create
To associate the VLAN interface with a physical interface and assign a VLAN ID, IP address, and netmask:
# ifconfig {vlan-name} {ip-address} netmask {subnet-mask} vlan {vlan-id} vlandev {physical-interface}
The following examples, all packets will be marked on egress with 802.1Q VLAN tags, specifying a VLAN ID of 500:
# ifconfig vlan500 10.0.0.1 netmask 255.255.255.0 vlan500 vlandev em0
To remove a VLAN interface, enter:
# ifconfig {vlan-name} destroy
To make configuration persistence, open /etc/rc.conf:
# vi /etc/rc.conf
Append / modify as follows:
cloned_interfaces=“vlan500 vlan600”
ifconfig_vlan500="inet x.x.x.x netmask y.y.y.y vlan 500 vlandev em0"
ifconfig_vlan600="inet x.x.x.x netmask y.y.y.y vlan 600 vlandev em0"
# ifconfig {vlan-name} create
To associate the VLAN interface with a physical interface and assign a VLAN ID, IP address, and netmask:
# ifconfig {vlan-name} {ip-address} netmask {subnet-mask} vlan {vlan-id} vlandev {physical-interface}
The following examples, all packets will be marked on egress with 802.1Q VLAN tags, specifying a VLAN ID of 500:
# ifconfig vlan500 10.0.0.1 netmask 255.255.255.0 vlan500 vlandev em0
To remove a VLAN interface, enter:
# ifconfig {vlan-name} destroy
To make configuration persistence, open /etc/rc.conf:
# vi /etc/rc.conf
Append / modify as follows:
cloned_interfaces=“vlan500 vlan600”
ifconfig_vlan500="inet x.x.x.x netmask y.y.y.y vlan 500 vlandev em0"
ifconfig_vlan600="inet x.x.x.x netmask y.y.y.y vlan 600 vlandev em0"
Saturday, January 3, 2009
Static ARP entry
arp -s ip_address ethernert_address
example:
arp -s 192.168.69.126 00:1f:f3:52:20:ed
arp -S ip_address ethernert_address
- Is just like -s except any existing ARP entry for this host will be deleted first.
example:
arp -S 192.168.69.126 00:1f:f3:52:20:ed
example:
arp -s 192.168.69.126 00:1f:f3:52:20:ed
arp -S ip_address ethernert_address
- Is just like -s except any existing ARP entry for this host will be deleted first.
example:
arp -S 192.168.69.126 00:1f:f3:52:20:ed
Sunday, March 9, 2008
Reset Forgotten MySQL Root Password
Have you ever forgotten the root password on one of your MySQL servers? No? Well maybe I’m not as perfect as you. This is a quick how to reset your MySQL root password. It does require root access on your server.
First things Log in as root and stop the mysql daemon. Now lets start up the mysql daemon and skip the grant tables which store the passwords.
mysqld_safe --skip-grant-tables
You should see mysqld start up successfully. If not, well you have bigger issues. Now you should be able to connect to mysql without a password.
mysql --user=root mysql
update user set Password=PASSWORD('new-password'); flush privileges; exit;
Now kill your running mysqld, then restart it normally. You should be good to go. Try not to forget your password again.
First things Log in as root and stop the mysql daemon. Now lets start up the mysql daemon and skip the grant tables which store the passwords.
mysqld_safe --skip-grant-tables
You should see mysqld start up successfully. If not, well you have bigger issues. Now you should be able to connect to mysql without a password.
mysql --user=root mysql
update user set Password=PASSWORD('new-password'); flush privileges; exit;
Now kill your running mysqld, then restart it normally. You should be good to go. Try not to forget your password again.
Subscribe to:
Posts (Atom)
