If you are familiar with Linux, you will appreciate the usefulness of "locate" utility. For some people who are not aware of it, Wikipedia says "locate is a Unix utility first created in 1983 used to find files on filesystems. It searches through a prebuilt database of files generated by updatedb or a daemon and compressed using incremental encoding. It is significantly faster than find, but requires the database to be updated regularly."
Before you use locate, you need to update the database first. On Linux, it is easily done by
#updatedb
On BSD, I simply could not find updatedb. If I run locate without updating database, Error! "locate database is too small". Googling, I found how to update it. Following command will update the locate database.
#/usr/libexec/locate.updatedb
Finally, I can use locate to find files in FreeBSD. :)
Some of my experiences related to Opensources such as Linux, Python programming, Bash Shell Scripting.....
Friday, August 27, 2010
Thursday, August 26, 2010
Installing Bash Shell On FreeBSD!
Today, I give a try to FreeBSD 8. After installation, I find out that its default shell is C Shell. I have been using Linux for 4 years or more, I prefer Bash to any other shells. After googling for a while, I can install Bash and set it as default shell for root user on BSD.
To install Bash Shell:
#pkg_add -r -v bash
You need to know the path to Bash Shell binary. Type:
#which bash
It will give you "/usr/local/bin/bash"
OK, we know where it is. Let's change the default shell for root user.
#chsh -s /usr/local/bin/bash root
Log out and in again.
Da..da! I get my favorite shell.
To install Bash Shell:
#pkg_add -r -v bash
You need to know the path to Bash Shell binary. Type:
#which bash
It will give you "/usr/local/bin/bash"
OK, we know where it is. Let's change the default shell for root user.
#chsh -s /usr/local/bin/bash root
Log out and in again.
Da..da! I get my favorite shell.
Thursday, August 12, 2010
How To Add Multiple Accounts On *nix OS By Using Bash Shell
Yes! It is not a big deal to add multiple accounts by using Bash Shell.
We can do it by:
#for x in aaa bbb ccc;do useradd $x; done
This command will add three users accounts : aaa, bbb, and ccc with no password.
What is your next move? Assigning password to each user by:
#passwd aaa
#passwd bbb
#passwd ccc
Three accounts is ok. How about adding 50 accounts? Will you repeat the same procedure to assign password for each account? It will be a time-consuming job. Here is the solution:
As you see, it will create three user accounts with default password "password"
My Motto - "Be Lazy In Outstanding Ways"
We can do it by:
#for x in aaa bbb ccc;do useradd $x; done
This command will add three users accounts : aaa, bbb, and ccc with no password.
What is your next move? Assigning password to each user by:
#passwd aaa
#passwd bbb
#passwd ccc
Three accounts is ok. How about adding 50 accounts? Will you repeat the same procedure to assign password for each account? It will be a time-consuming job. Here is the solution:
As you see, it will create three user accounts with default password "password"
My Motto - "Be Lazy In Outstanding Ways"
Monday, August 9, 2010
The Poorest Solutions To Send sms To Mobiles From Linux Box !
"HEY! Netlynker! We don't have a extra handset like you. So how?"
I have already expected this question. Fortunately for people in Singapore, Starhub, Singtel and M1 provide web 2 sms service so that you can use internet to send sms to mobile phones. But there is one catch: we can only send sms via web interface and they don't provide API for you.So you must find a way to weaponize these services for Linux Box. How? Honestly, I also don't know how to do it. :P
But I do know how to make use of the things that other people have created.A gentleman called Zhi Xiong created the bash shell scripts for these three Mobile Operators. Because of his work, I can copy it without exhausting my brain.( Even if I do, it will be useless. :) )
Here are his works.
Ok! Now you can also make use of it,exploit it or whatever..You can also show off to your friends in the night club.
"Folks! All of my servers are down and sending sms to me. How capable I am! " :D
PS: All Credits and Complaints will go to him: Zhi Xiong
I have already expected this question. Fortunately for people in Singapore, Starhub, Singtel and M1 provide web 2 sms service so that you can use internet to send sms to mobile phones. But there is one catch: we can only send sms via web interface and they don't provide API for you.So you must find a way to weaponize these services for Linux Box. How? Honestly, I also don't know how to do it. :P
But I do know how to make use of the things that other people have created.A gentleman called Zhi Xiong created the bash shell scripts for these three Mobile Operators. Because of his work, I can copy it without exhausting my brain.( Even if I do, it will be useless. :) )
Here are his works.
Ok! Now you can also make use of it,exploit it or whatever..You can also show off to your friends in the night club.
"Folks! All of my servers are down and sending sms to me. How capable I am! " :D
PS: All Credits and Complaints will go to him: Zhi Xiong
Wednesday, August 4, 2010
Sending SMS from Linux Box to My Mobile.
- Handset == Nokia 6300 with usb cable
- OS == Ubuntu 9.10 (upgraded from 9.04)
- Goal == To test whether Linux Box can send sms alerts to any mobile numbers.
- Software == gammu (opensource gsm software for *nix platform)
#apt-get install gammu
To Configure -
#gammu-config
port = /dev/ttyACM0 #your port may differ from me depending on your ph model and cable.
model = nokia autodetection
It will save a .gammurc config file in your home directory
#gammu --identify # it will list your connected mobile devices , In my case Nokia 6300.
To test sms to any phone -
#gammu sendsms text +659457xxxx
Enter message text and press ^D:
I love opensource!!
Sending SMS 1/1....waiting for network answer..OK, message reference=2
People may say "Hey guy. Why do you want to sms from Linux box while you can directly send from mobile phone?" As A System Admin, sometimes we need a way to know critical events of our servers on the spot. For example, we can configure gammu with Nagios Monitoring Server so that it will sms to my mobile whenever a network service is down. Cool? Or Annoying?
Subscribe to:
Posts (Atom)