Archive for January, 2010
Keep Your SSH Session Running when You Disconnect
by lpilinuxblog on Jan.25, 2010, under Linux Tricks
“Screen is like a window manager for your console. It will allow you to keep multiple terminal sessions running and easily switch between them. It also protects you from disconnection, because the screen session doesn’t end when you get disconnected.
You’ll need to make sure that screen is installed on the server you are connecting to. If that server is Ubuntu or Debian, just use this command:
sudo apt-get install screen
Now you can start a new screen session by just typing screen at the command line. You’ll be shown some information about screen. Hit enter, and you’ll be at a normal prompt.
Check your Disk Usage on Ubuntu from the command line
by lpilinuxblog on Jan.25, 2010, under Linux Tricks
“Ubuntu Linux, like all unix varieties, includes the du command line utility. du stands for Disk Usage, as I’m sure you assumed.
Go ahead, just type the command in your home directory:
geek@ubuntu-desktop:~$ du
8 ./.gconf/desktop/gnome/accessibility/keyboard
12 ./.gconf/desktop/gnome/accessibility
8 ./.gconf/desktop/gnome/screen/default/0
12 ./.gconf/desktop/gnome/screen/default
16 ./.gconf/desktop/gnome/screen
8 ./.gconf/desktop/gnome/font_rendering
40 ./.gconf/desktop/gnome
44 ./.gconf/desktop
8 ./.gconf/apps/panel/applets/clock_screen0/prefs
16 ./.gconf/apps/panel/applets/clock_screen0
8 ./.gconf/apps/panel/applets/trashapplet_screen0
8 ./.gconf/apps/panel/applets/workspace_switcher_screen0/prefs
16 ./.gconf/apps/panel/applets/workspace_switcher_screen0
It shows you a very verbose output by default, which isn’t always extremely useful. Thankfully it also includes a lot of extra options.
To find the total size of files and folders in our current directory, listed by MB:
Backup MySQL Database to a file
by lpilinuxblog on Jan.25, 2010, under Linux Tricks
“Backing up your database is a very important system administration task, and should generally be run from a cron job at scheduled intervals. We will use the mysqldump utility included with mysql to dump the contents of the database to a text file that can be easily re-imported.
Syntax:
mysqldump -h localhost -u root -pmypassword databasename > dumpfile.sql
Example:
mysqldump -h localhost -u root -p2Uad7as9 database01 > dumpfile.sql
This will give you a text file containing all the commands required to recreate the database.”howtogeek.com
An interview with Linus Torvalds
by lpilinuxblog on Jan.25, 2010, under About LPI
“Linus Torvalds, a computer science student at the University of Helsinki in his early twenties, took his first course on Unix and C in the Fall of 1990. In the Spring of 1991 Linus was running Minix (a small Unix-like operating system designed for teaching) at home on his new 386. What was to become Linux started in the Summer of 1991 as a basic protected mode system that evolved from a Hello World program into a terminal program. By October 1991 Linux 0.02 was announced to the world. In two years, through the hard work of Linus and many other people, Linux, currently at version 0.99, has become an extremely useful and popular operating system. The comp.os.linux.* hierarchy is among USENETs busiest and there are several companies selling Linux and providing professional support. All this in such a short time, yet Linux is available for free, and development has almost entirely been done by volunteers. Meta interviewed Linus via E-mail to probe his mind about Linuxs future and the environment it is developed in. The results follow…
Linux Time Line
by lpilinuxblog on Jan.25, 2010, under Reviews
“Ready? Here we go:
August 1991
“Hello everybody out there using minix – I’m doing a (free) operating system (just a hobby, won’t be big and professional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready. I’d like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the file-system (due to practical reasons) among other things).I’ve currently ported bash(1.08) and gcc(1.40), and things seem to work. This implies that I’ll get something practical within a few months, and I’d like to know what features most people would want. Any suggestions are welcome, but I won’t promise I’ll implement them
Linus (PS. Yes – it’s free of any minix code, and it has a multi-threaded fs. It is NOT protable (uses 386 task switching etc), and it probably never will support anything other than AT-harddisks, as that’s all I have
.”
September 1991
Advanced Tips for Search-and-Replace in Linux
by lpilinuxblog on Jan.18, 2010, under About LPI
Let’s say that you’ve just decided to rename a variable from foo to fooOne. In Vim, hit Esc for command mode, then use this command:
:%s/foo/fooOne/g
% means that the operation should be carried out throughout the whole document. The important part is s/foo/fooOne/, which means “replace every instance of ‘foo’ with ‘fooOne’”. The final g means “global”; without this you’ll just replace the first instance on every line, but with it, you replace every occurrence.
To use this search-and-replace pattern in Emacs, hit M-x then type replace-string RET foo RET fooOne.
Hardening the OpenSSH Server for Password Logins
by lpilinuxblog on Jan.18, 2010, under Linux Tricks
This is easy, just changing a few lines in /etc/ssh/sshd_config:
Port 2022
PermitRootLogin no
AllowUsers [usernames or groups separated by spaces]
ListenAddress 192.168.1.1
ClientAliveInterval 3600
Remember to restart sshd whenever you change the configuration file. Specifying an alternate port reduces brute-force login attempts by a lot. Yes, everyone knows that this option is available, and no, it wouldn’t be very hard to script brute-force attacks to scan for the open SSH port. But they don’t, and a side benefit is it cuts down the clutter considerably in your logfiles. You must select an unused port, which you can find in /etc/services. Be sure to enter your alternate SSHD port in this file so you don’t forget.
Upgrading: x64 edition, version 7 to version 8
by lpilinuxblog on Jan.18, 2010, under About LPI
Warnings:
* This upgrade path is for the x64 Edition only, from a Mint 7 Gloria system to a Mint 8 Helena system.
* There is no guarantee that it will work for you. In fact this is quite a risky process. If you’re experienced and if you know how to troubleshoot and solve common Linux problems (in particular X11, kernel modules and APT problems) then you’re probably OK. If you’re a novice user we recommend you perform a fresh installation of Linux Mint 8 instead.
* You should make backups of all your data before upgrading.
Configuring Strong Wi-fi (802.1x) Authentication in Linux
by lpilinuxblog on Jan.18, 2010, under Linux Tricks
In this tutorial series, we’ll first see how 802.1X authentication fits into the big picture of wireless LAN security. Then we’ll configure the authentication settings in Ubuntu. Lastly, we’ll review the manual configuration of 802.1X supplicants. Lets get started!
The transition from WEP to WPA to WPA2
Back when the vulnerabilities of WEP encryption for Wi-Fi networks were uncovered, the IEEE and wireless industry started developing new protocols and standards. They came up with the 802.11i, a standard to finally implement a fully secure encryption mechanism for wireless LANs. Before it was completed, the Wi-Fi Alliance released the Wi-Fi Protected Access (WPA) encryption standard, loosely based on 802.11i using TKIP for the underlying encryption. Later they released WPA2, which includes full support for 802.11i using AES/CCMP encryption.
BASH Tips Again
by lpilinuxblog on Jan.18, 2010, under Linux Tricks
Here are some tips for working in the shell that I use on a daily basis. These may be known to most veterans, please contribute your favorite shortcuts to the comments. But for the most part this is not for the uber leet Linux geek, this is for those new to the terminal.
TAB
- Gives you suggestions / completes stuff for you. Type a, Press it twice, it will make your life a lot easier.
ctrl+w
- Remove word behind cursor.
ctrl+u
- Undo / Erase everything from cursor to beginning of the line