The Best Linux Articles

Chances are if you’re a new reader, you haven’t read a lot of the stuff here that seems to get buried in the archives. Here are some of our most popular articles for your enjoyment:

How to record your Linux shell session

A lot of people are probably not aware of the command script. Script is a quick and easy way to record everything you do in a terminal session.  I use script to record sessions of me fixing a server, or troubleshooting Linux issues, and save it for future needs, or to pass on to others as training material.  Here is what the Linux man page says:

Script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later with lpr(1).

Using script to record your terminal session

It’s really quite simple to record your bash session.  All you need to do is type script -a filename to start recording your session:

laptop:~ foogazi# script -a session1_jun162010
Script started, output file is session1_jun162010
laptop:~ foogazi#

Now that the recording has started, everything you type, as well as everything that returns as output, will be saved into the filename you chose to output to.

Linux rename user command

I’ve gotten this question a whole bunch of times in the past.  You’ve got a Linux username that you want to rename, rather than recreate, so you don’t lose any significate data or permission settings.  How do you rename a Linux user?

Linux rename user command

To rename a Linux user (rename user name), you want to use the Linux command usermod.  From the man page:

The usermod command modifies the system account files to reflect the changes that are specified on the command line.

In short, here is the command to rename the Linux user:

usermod -d "/home/current_user-name" -m -l current_user_name new_user-name

And now an explanation of what each option means:

  • -d specifies the current users home directory.
  • -m specifies that you want to move the files from the current users home directory, to the new directory. You want to make sure you specify this, otherwise the users data will not transfer over to the new user account.
  • -l specifies the current user name, and the new user name you wish to change it to.

That’s it. Now you’ve renamed a Linux user.

The Best Resources To Help You Learn MySQL

Chances are that if you’re a Linux and open source geek like most of the visitors to Foogazi are, you probably know a little bit about MySQL.  But if you’re a true geek, you want to learn all there is to know.  Databases power just about everything on the Internet these days, and MySQL is one of the most popular web databases languages there is.  Not only is it a great tool, but it’s a great language to know.

Here are some great tips to help you learn MySQL.

Visit MySQL Forums

As with anything you’re trying to learn, it’s always best to become an active member of the community.  Not only will you gather valuable information from people all around you, but you’re in a place with other likeminded people.  Being active in forums is key to learning the most you can.  MySQL forums contain a ton of great tips and useful information.

Here are a few MySQL forums for you to check out:

MySQL Mailing Lists

Just as important becoming an active member in MySQL forums is, it is also important to participate in mailing list discussions.  Some of my biggest “oh I get it” moments have been from emails posted to mailing lists.  Along with forums, mailing lists are a great place to throw out a question and get a quick answer.

Check out the only resource for MySQL Mailing Lists you need:

Planet MySQL

Planet MySQL is an aggregation of blogs and news from MySQL developers and users.  This is site is a must resource. RSS, web browser, whatever way you like to read, this should be one of your most frequented websites when trying to learn MySQL.

Check out planet mysql here:

Official MySQL Documentation

The MySQL website offers a ton of useful documentation and resources, so obviously this is going to be one place you’ll want to frequent. The MySQL reference manuals are a must have when learning MySQL.

Check out the MySQL documentation here:

MySQL Books

MySQL books are obviously one of the best resources to learn from.  I personally prefer a tangible book I can bring with me anywhere to learn from.

Here are some of my favorite MySQL books:

Of all the things I’ve listed as being the best resources to learn MySQL, I must say for me, the most important one is active participation with the community.  The more you ask questions, the more you learn.  The more you teach, the more you learn.  You can’t lose either way.

How do you prefer to learn? Have some more resources? Let us know in the comments!

How to configure static IP on Ubuntu

Do you use Ubuntu and wish to set a static IP for your machine?  It’s simple. Follow the steps below to find out how.

  • Right click the network manager icon at the top right of your desktop
  • Select Edit Connections
  • Select Wired
  • Click the EDIT button
  • Click the IPv4 settings tab
  • Select Manual from the method drop down list
  • Click the ADD button to add your static IP address
  • Add your DNS addresses in the DNS servers field. You can separate each DNS entry with a comma
  • Click OK.
  • Restart networking using this command: /etc/init.d/networking restart

How to reset your Linux Password

If you’ve ever forgotten your Linux password, chances are you’ve needed to either restore your Linux installation.  Hopefully this solution will save you from having to reinstall Linux in the event that you forget your password.

Reset your Linux password using Grub:

When your machine boots into Grub, you’ll want to press “e” to edit the grub boot linux.

After pressing “e”, navigate to the kernel line and add the word “single” to the end of the long string.

Press “b” to boot into single user mode.

You should then be taken directly to a root user shell, where you can then type passwd, and change your root password.

After you’ve reset your root password, type reboot at the shell to leave single user mode.

Linux Malware – Proof that Linux is not as secure as we all think

There was an interesting post on Ask Slashdot discussing the ethics of releasing non-malicious Linux malware to simply prove a point to all of the people who rant and rave about Linux being so secure.  A developer by the name of buchner.johannes

buchner.johannes writes:

“I was fed up with the general consensus that Linux is oh-so-secure and has no malware. After a week of work, I finished a package of malware for Unix/Linux. Its whole purpose is to help white-hat hackers point out that a Linux system can be turned into a botnet client by simply downloading BOINC and attaching it to a user account to help scientific projects. The malware does not exploit any security holes, only loose security configurations and mindless execution of unverified downloads. I tested it to be injected by a PHP script (even circumventing safe mode), so that the Web server runs it; I even got a proxy server that injects it into shell scripts and makefiles in tarballs on the fly, and adds onto Windows executables for execution in Wine. If executed by the user, the malware can persist itself in cron, bashrc and other files. The aim of the exercise was to provide a payload so security people can ‘pwn’ systems to show security holes, without doing harm (such as deleting files or disrupting normal operation). But now I am unsure of whether it is ethically OK to release this toolkit, which, by ripping out the BOINC payload and putting in something really evil, could be turned into proper Linux malware. On the one hand, the way it persists itself in autostart is really nasty, and that is not really a security hole that can be fixed. On the other hand, such a script can be written by anyone else too, and it would be useful to show people why you need SELinux on a server, and why verifying the source of downloads (checksums through trusted channels) is necessary. Technically, it is a nice piece, but should I release it? I don’t want to turn the Linux desktop into Windows, hence I’m slightly leaning towards not releasing it. What does your ethics say about releasing such grayware?”

This is a great thing for the community at large to see that Linux can be exploited with malware just like it’s rival operating systems.  However, I share the same concerns the developer does.  This indeed could result in a black-hat user injecting something malicious into the code and actually turning the example into real evil malware. I’m on the fence though, maybe this is what Linux users need to prove that we aren’t like typical Windows users who click any random link and download any random software from any random untrusted third-party site.  A user who goes by the name of silentcoder wrote: “Linux users (hardly ever) download and install software from the internet. We download and install packages from repositories. The average user simply cannot tell the difference between a useful piece of freeware and a bugridden-malware-spreading piece of add-ware.”

Paranoia aside, this definitely proves that Linux is just as susceptible to malware and viruses as any other operating system.  But, as I’ve always said, viruses and malware are usually a result of user error, no matter the operating system.

What do you all think, should this type of code be released as proof of concept even if it’s risking malicious manipulation?  Should we all just start using SELinux and be done with it?

Must have Linux books for Christmas

The gift giving season is right around the corner and if you have any geeky relatives or friends, then this list of Linux books to buy for Christmas is a good reference.  Click each image to find out more.

Linux Bible 2010 Edition: Boot Up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 13 Other Distributions

Linux Administration: A Beginner’s Guide, Fifth Edition

Practical Guide to Linux Commands, Editors, and Shell Programming

How Linux Works: What Every Superuser Should Know

Linux Command Line and Shell Scripting Bible

Linux System Administration

Beginning the Linux Command Line

Pro Linux System Administration

Linux Security Cookbook

Hardening Linux

7 Must Have Linux iPhone Applications

If you’re anything like me and love tech gadgets that allow you to do almost anything..then you undoubtedly own an iPhone.  For the past year of being an iPhone owner, I’ve discovered a ton of iPhone apps that help me in my every day life.  Many of them are Linux apps.  Below you will find a list I’ve put together of must have Linux iPhone apps for you to check out.

Linux Command Reference (FREE) – This iPhone app is a handy command reference for the Linux Terminal.  Perfect for situations when you need to reference a command but you’re in the server room without your computer.

LinuxTube – This app allows you to view Linux related videos as well as chat with other Linux enthusiasts.

Server Remote – Easily monitor your Linux server from your iPhone.  This iPhone application uses the standard SSH protocol to communicate with your servers, and requires no special software to be installed on the server end.

SSH – The best SSH client I’ve found in the iPhone app store. It works over Wi-Fi, Edge, and 3G networks.

Chmod (FREE) – Very simple and straight forward reference app for determining file and directory permissions on Mac OS X, Linux and Unix.

Vi Reference – A great reference for those of us who use Vi/Vim.

UNIX Fortune – For those old school nix users, this is the entertaining fortune cookie application converted to an iPhone app.

Hopefully these Linux iPhone apps save you a little bit of time, or just provide some good old fashion entertainment, like they have me.

Do you know of any other iPhone apps available that should be added to this list? Let us know in the comments!

Can Linux Save the IT Industry in this Econmic Downturn?

Over at Internet News Sean Kerner writes that the IT industry is turning to Linux in our current economic downturn.

A new report out today from IDC, sponsored by Linux vendor Novell indicates that the current economic downturn is a good thing for Linux adoption. with more than half of the IT executives surveyed planning to accelerate Linux adoption in 2009… According to IDC, in a poll of 300 IT professionals more than 72 percent reported that, “they are either actively evaluating or have already decided to increase their adoption of Linux on the server in 2009.”

I’m sure most of our readers have heard that Linux, as well as open source, is a great option during times of economic stress.  Companies and even every day users are turning to cheaper and free alternatives to expensive software and operating systems and Linux is just the right place to turn.

This is a great thing for Linux, even though it sucks for our current state of the economy.  Let’s just hope Linux can prove worthy and benefit in these tough times.

Read the full article here.