Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Sunday, December 14, 2008

Most Common Mistakes made by Linux Administrators

This article will help you avoid those mistakes by laying out the most typical Linux missteps.

Installing applications from various types

This might not seem like such a bad idea at first. You are running Ubuntu so you know the package management system uses .deb packages. But there are a number of applications that you find only in source form. No big deal right? They install, they work. Why shouldn’t you? Simple, your package management system can’t keep track of what you have installed if it’s installed from source. So what happens when package A (that you installed from source) depends upon package B (that was installed from a .deb binary) and package B is upgraded from the update manager? Package A might still work or it might not. But if both package A and B are installed from .debs, the chances of them both working are far higher. Also, updating packages is much easier when all packages are from the same binary type.

Neglecting updates

Okay, this one doesn’t point out Linux as much as it does poor administration skills. But many admins get Linux up and running and think they have to do nothing more. It’s solid, it’s secure, it works. Well, new updates can patch new exploits. Keeping up with your updates can make the difference between a compromised system and a secure one. And just because you can rest on the security of Linux doesn’t mean you should. For security, for new features, for stability — the same reasons we have all grown accustomed to updating with Windows — you should always keep up with your Linux updates.

Poor root password choice

Okay, repeat after me: “The root password is the key to the kingdom.” So why would you make the key to the kingdom simple to crack? Sure, make your standard user password something you can easily remember and/or type. But that root password — you know, the one that’s protecting your enterprise database server — give that a much higher difficulty level. Make that password one you might have to store, encrypted, on a USB key, requiring you to slide that USB key into the machine, mount it, decrypt the password, and use it.

Avoiding the command line

No one wants to have to memorize a bunch of commands. And for the most part, the GUI takes care of a vast majority of them. But there are times when the command line is easier, faster, more secure, and more reliable. Avoiding the command line should be considered a cardinal sin of Linux administration. You should at least have a solid understanding of how the command line works and a small arsenal of commands you can use without having to RTFM. With a small selection of command-line tools on top of the GUI tools, you should be ready for just about anything.

Not keeping a working kernel installed

Let’s face it, you don’t need 12 kernels installed on one machine. But you do need to update your kernel, and the update process doesn’t delete previous kernels. What do you do? You keep at least the most recently working kernel at all times. Let’s say you have 2.6.22 as your current working kernel and 2.6.20 as your backup. If you update to 2.6.26 and all is working well, you can remove 2.6.20. If you use an rpm-based system, you can use this method to remove the old kernels: rpm -qa | grep -i kernel followed by rpm-e kernel-{VERSION}.

Not backing up critical configuration files

How many times have you upgraded X11 only to find the new version fubar’d your xorg.conf file to the point where you can no longer use X? It used to happen to me a lot when I was new to Linux. But now, anytime X is going to be updated I always back up /etc/X11/xorg.conf in case the upgrade goes bad. Sure, an X update tries to back up xorg.conf, but it does so within the /etc/X11 directory. And even though this often works seamlessly, you are better off keeping that backup under your own control. I always back up xorg.conf to the /root directory so I know only the root user can even access it. Better safe than sorry. This applies to other critical backups, such as Samba, Apache, and MySQL, too.

Booting a server to X

When a machine is a dedicated server, you might want to have X installed so some administration tasks are easier. But this doesn’t mean you should have that server boot to X. This will waste precious memory and CPU cycles. Instead, stop the boot process at runlevel 3 so you are left at the command line. Not only will this leave all of your resources to the servers, it will also keep prying eyes out of your machine (unless they know the command line and passwords to log in). To log into X, you will simply have to log in and run the command startx to bring up your desktop.

Not understanding permissions

Permissions can make your life really easy, but if done poorly, can make life really easy for hackers. The simplest way to handle permissions is using the rwx method. Here’s what they mean: r=read, w=write, x=execute. Say you want a user to be able to read a file but not write to a file. To do this, you would issue chmod u+r,u-wx filename. What often happens is that a new user sees an error saying they do not have permission to use a file, so they hit the file with something akin to chmod 777 filename to avoid the problem. But this can actually cause more problems because it gives the file executable privileges. Remember this: 777 gives a file rwx permissions to all users (root, group, and other), 666 gives the file rw privileges to all users, 555 gives the file rx permissions to all users, 444 gives r privileges to all users, 333 gives wx privileges to all users, 222 gives w privileges to all users, 111 gives x privileges to all users, and 000 gives no privileges to all users.

Logging in as root user

I can’t stress this enough. Do NOT log in as root. If you need root privileges to execute or configure an application, su to root in a standard user account. Why is logging in as root bad? Well, when you log on as a standard user, all running X applications still have access only to the system limited to that user. If you log in as root, X has all root permissions. This can cause two problems: 1) if you make a big mistake via a GUI, that mistake can be catastrophic to the system and 2) with X running as root that makes your system more vulnerable.

Ignoring log files
There is a reason /var/log exists. It is a single location for all log files. This makes it simple to remember where you first need to look when there is a problem. Possible security issue? Check /var/log/secure. One of the very first places I look is /var/log/messages. This log file is the common log file where all generic errors and such are logged to. In this file you will get messages about networking, media changes, etc. When administering a machine you can always use a third-party application such as logwatch that can create various reports for you based on your /var/log

Read more!

Thursday, December 4, 2008

Minimize removable media headaches in Linux

For many new Linux users, removable media can be a deal-breaker. Anyone coming over from Windows knows you simply insert the CD, use it, and eject it. With Linux, it isn't always that simple. In fact, with Linux, removable media has always held a completely different philosophy.
In the old days of UNIX, removable media was seen in the same light as the PC itself -- multi-user. So when you inserted some form of media (usually a floppy disk, back then), it had to be mounted to a mount point (such as /mnt/floppy) and was then made available to all users on the system. Because of this, the removable media synchronization wasn't "on demand." It typically worked by caching the data until the media was unmounted. Upon unmounting the media, the data was written and the media could be removed.

Linux has caught up to the needs of today's user and, in many cases, the media mounting/unmounting is automatic. But not every situation is the same. Here are some tips that should make your Linux life with removable media better.


Use the right desktop
The right desktop can make your job so much easier. The newest releases of both KDE and GNOME offer systems that check for the insertion of removable media. When a CD is inserted, you will be greeted with a window asking what you would like to do with the media. You can even set that action you choose as the default action to take upon insertion of that type of media. Those desktops also have applets that reside in the panel (or desktop icons) that allow you to easily mount and unmount the media with a click of the mouse. No more entering commands like mount /dev/cdrom /media/cdrom.


Get to know /etc/fstab

Because I generally stick with more old-school desktops (such as Enlightenment DR16), I often still have to mount my removable media. So instead of having to issue the full command mount /dev/sda1 /media/mp3 to mount my MP3 player, I will add a line to my /etc/fstab file that will do two things: Point the device to the correct mount point and make sure the mount point is both readable and writable by the user. The fstab entry will look something like this:

/dev/sda1 /media/ipod vfat users,exec,noauto,managed 0 0

Now when you need to mount the device, enter mount /media/ipod. Just remember to unmount the device before you remove it.


Use udev to make your life easier
Let's build upon using fstab to simplify mount of removable media. Let's say you have an entry in your /etc/fstab file for your iPod pointing it from /dev/sda1 to /media/ipod. Now let's say you plug in another USB device or reboot. The problem is that entry in your fstab file may or may not be valid now because /dev/sda1 might be used by something else. To avoid this, make use of the udev system. You're going to tell udev to always make sure that device shows up with the same filename. Enter a line in the /etc/udev/rules.d/00.rules file that looks like:

## iPod
BUS="scsi", SYSFS{model}="iPod*", NAME="ipod"

Of course, your entry in /etc/fstab will have to change to reflect the above. So now /etc/fstab will look like:

/dev/ipod /media/ipod vfat users,exec,noauto,managed 0 0


Use menu entries for mount/umount
Back in the day, when I used AfterStep, I always had a submenu that included an entry for mounting and unmounting both the floppy and the CD-ROM. This made life much easier because I no longer had to open up a command line and enter the mount and umount commands to use the device. Granted, the window manager you use will determine how this is employed. For example, in Enlightenment, I can create two entries in the user_apps.menu file that look like:

"mount iPod" NULL exec "mount /media/ipod"
"umount iPod" NULL exec "umount /media/ipod"

Now on the Enlightenment menu, I will see two entries: mount iPod and umount iPod. With the device connected all I have to do is click the mount entry. To remove the device I only need to click the umount entry.


Be safe with your removable hard drives
One time, I left a USB drive plugged into a machine I was re-installing the operating system on. I wasn't paying enough attention and wound up with an operating system spanning both my internal drive and my removable drive. Yes, this was a big mistake and no, it has never happened since. Why? Because anytime I install an OS on a machine with a removable drive, that removable drive is removed during installation. It's not a problem, because upon first boot, I plug the drive back in and it is always automatically recognized and mounted. Of course, I will make an entry in /etc/fstab that will automatically mount the drive on boot.


Never forget to use the dmesg command
When you plug in a device or insert removable media, the dmesg command will give you the status of the system. For example, when I insert an iPod into a Mandriva 2008 machine I run the dmesg command and see:

usb 1-4: new high speed USB device using ehci_hcd and address 2
usb 1-4: configuration #1 chosen from 3 choices
usb 1-4: USB disconnect, address 2
usb 1-4: new high speed USB device using ehci_hcd and address 3
usb 1-4: configuration #1 chosen from 2 choices
Initializing USB Mass Storage driver...
scsi2 : SCSI emulation for USB Mass Storage devices
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 3
usb-storage: waiting for device to settle before scanning
scsi 2:0:0:0: Direct-Access Apple iPod 1.62 PQ: 0 ANSI: 0
sd 2:0:0:0: [sdb] 58605120 512-byte hardware sectors (30006 MB)
sd 2:0:0:0: [sdb] Write Protect is off
sd 2:0:0:0: [sdb] Mode Sense: 68 00 00 08
sd 2:0:0:0: [sdb] Assuming drive cache: write through
sd 2:0:0:0: [sdb] 58605120 512-byte hardware sectors (30006 MB)
sd 2:0:0:0: [sdb] Write Protect is off
sd 2:0:0:0: [sdb] Mode Sense: 68 00 00 08
sd 2:0:0:0: [sdb] Assuming drive cache: write through
sdb: sdb1 sdb2
sd 2:0:0:0: [sdb] Attached SCSI removable disk
sd 2:0:0:0: Attached scsi generic sg1 type 0
usb-storage: device scan complete

From this, I know the device is being seen at /dev/sdb. Without knowing this, I would have a hard time guessing where the device has been mapped to.


Don't forget the eject command
Most people don't know that there's a command to eject CDs from the CD drive. Naturally, this isn't an issue for those who have tray CD drives. But for those with slot-loading CD drives, eject will save you from pulling your hair out. After you have used and unmounted your CD drive, open up a terminal and enter the eject command, and your CD will pop out. To simplify the process, make a menu entry for the command.


Remember that the mount command tells all
If you're unsure what devices are mounted on your system, issue the mount command to see a listing of everything currently mounted on your machine. The output looks like:

/dev/sda1 on / type ext3 (rw)
none on /proc type proc (rw)
/dev/sda6 on /home type ext3 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
none on /sys/fs/fuse/connections type fusectl (rw)

From this output, I can see that I have no removable media mounted on the machine. So I know it's safe to unplug anything removable. Had there been an entry for, say, my iPod, I would know not to remove the device without unmounting it. Of course, on modern systems (using one of the major desktops), this will be made clear with the icon or the removable device applet on the panel. But this command will be helpful (along with dmesg) in debugging removable media issues.

Reformat your iPod to a Windows format
If you've tried to add songs on a Mac-formatted iPod on Linux, you've probably discovered that it's not possible without jumping through hoops even programmers don't want to jump through. Format your iPod in Windows format, and you won't have any problems using your iPod with Amarok, Banshee, or gtkpod.


Allow others to connect to your removable media
In my office, I have a removable drive mounted to /media/music that contains my entire music collection. I allow others to listen to that music via samba by including it as a share. I like doing this far better than allowing users to have access to my internal drive because 1) it keeps anyone from trashing the drive containing my OS and 2) it allows me to keep sensitive data physically separated from shared data. This approach doesn't have to be used for music, either. It's a great way to share interoffice files or have a single repository for backups. Once the drive is full, remove it and store it. Just add a new removable drive for the new backup.

Simpler, easier
Not only is today's Linux not nearly as challenged with removable media as it once was, it's really quite flexible and user friendly. With the help of these tips, you should now see how you can expand your Linux experience to include various ways to employ removable media.

Read more!

Monday, June 2, 2008

Cut down on Linux command-line typing with these 10 handy bash aliases

The Linux desktop has come a long, long way, but there are still times when I have to use the command line. (I am a hardcore user, after all.) But even though I'm used to typing, spending hours upon hours with my fingers at the keyboard, I still grow tired of typing the same commands over and over. To reduce that tedium, I always add aliases to my .bashrc file

What is an alias?
An alias is basically a shortcut for a command you place in your ~/.bashrc file. Aliases cut down on typing and can save you from having to look up a command

Aliases are set up near the bottom of the of the .bashrc file. You'll see a commented-out section that indicates where you should put them. The format of an alias is:

Alias NICKNAME='full command here'

The keyword alias must be used. The nickname is what you will type at the command line. Make this nickname easy to remember. The = sign must also be used. After the = sign, you enter the full command, including flags and switches, enclosed in single quotes. Once you are done, save the .bashrc file and open up a new terminal. I always find it best to leave the original terminal window open in case there are problems. In the new terminal, type the alias nickname and the command will run.

Following list of aliases to help make a command-line experience a bit easier

1. The ssh alias
This one should be a no-brainer for those of you who frequently secure shell into particular boxes. For this I add an alias like so:

alias server_name='ssh -v -l USERNAME IP ADDRESS'

Just change server_name to a memorable name for the server. Then, change USERNAME and IP ADDRESS to suit your needs.


2. The ls aliases
Some distributions don't include some of the handier ls commands. Generally, I like to see full listings instead of just filenames. For that I always include this alias:

alias ll='ls -l'

Another handy ls alias is this:

alias la='ls -a'


3. The rm safety net
I can't tell you how many times I have "rm'd" a file I shouldn't have "rm'd". To avoid this, I add this alias:

alias rm='rm -i'

Adding the '-i' flag it forces rm into interactive mode, which asks whether you're sure you want to remove a file


4. A more useful df command
This handy tool tells you how much space you have left on a drive. Only thing is, if you run the command by itself it replies in 1K blocks. Most people would prefer to see this in terms of MB. To make that happen, add this alias:

alias df='df -h'

Now, every time you run the df command, the information will be returned in a human-readable format


5. The nonstandard Firefox
Many times, I install Firefox in strange directories (or have more than one version of Firefox installed for testing purposes). For this, I will add an alias to start the correct Firefox. Say, for example, I have the beta of the newest, upcoming Firefox release installed, as well as the current stable Firefox. They are both installed in my home directory in different subdirectories. I will then add two aliases like so:

alias ff1='/home/jlwallen/firefox/firefox'
alias ff2='/home/jlwallen/firefoxb3/firefox'

Now I can start the stable firefox with ff1 or the beta with ff2


6. The bookmark alias
Speaking of Firefox, let's create an alias to open up it to a specific URL:

alias ffg='/home/jlwallen/firefox/firefox http://www.google.com'

This alias will open Firefox directly to the Google site


7. The constant editing of a file
There are certain files that I am constantly editing. For instance, when I used Enlightenment E16 (I now use E17), I was frequently editing the menu file ~/e16/menus/user_apps. Instead of constantly opening up a terminal and entering nano ~/.e16/menus/user_apps, I used an alias that allowed me to type emenu and start editing. I used this alias:

alias emenu='aterm nano -e ~/.e16/menus/user_apps'

Now, I just enter the command emenu (or I can enter that in the run command dialog) to open up this file in an editor


8. The apt-get update
There are numerous ways to use an alias to help you with apt-get. One of my favorite is to add this alias:

alias update='sudo apt-get update'

I only need to enter update and will be prompted for the sudo password. You can modify this to suit your frequent apt-get needs


9. The rpm batch install
I like to do a lot of batch installing with rpm. I will typically dump a bunch of rpm files into an empty directory (created for this specific purpose) and run the command rpm -ivh ~/RPM/*rpm. Of course, an alias makes this even easier:

alias brpm='rpm -ivh ~/RPM/*rpm'

You have to create the ~/RPM directory and enter the root password for this to work


10. The long, arduous path
There are some paths that I often change to that seem to take eons to type. When I was working on the Afterstep window manager, I had to constantly change to the ~/GNUstep/Library/AfterStep/start to edit menus. After a while, you get tired of typing cd ~/GNUstep/Library/AfterStep/start just to get to the directory. So I added an alias like so:

alias astart='cd ~/GNUstep/Library/AfterStep/start'

Naturally, you can change that to fit your needs. This will save you a lot of typing


So there you have it: a few simple bash aliases that will ease the load on your fingers. You can modify them to suit you, and they'll give you a good start on creating your own handy bash aliases

Read more!

Friday, May 30, 2008

10 ways to secure your Linux desktop

A Linux desktop is far more secure than most others. But this level of security doesn't necessarily involve typical security-focused software or techniques. Sometimes, the easiest means to security are those measures that are the easiest to forget. Let's take a look at 10 things you can do to secure a Linux desktop.
Note that we're talking about the desktop, not a server. Linux server security is another beast all together -- one that would confuse the average desktop user.


1. Locking the screen and logging out is important
Most people forget that the Linux desktop is a multi-user environment. Because of this, you can log out of your desktop and others can log in. Not only does that mean that others could be using your desktop, it also means you can (and should) log out when you're finished working. Of course, logging out is not your only option. If you are the only user on your system, you can lock your screen instead. Locking your screen simply means that a password will be required to get back into the desktop. The difference here is that you can leave applications running and lock the desktop. When you unlock the desktop, those same programs will still be running. Safe and secure.

2. Hiding files and folders is a quick fix
In Linux-land, files and folders are hidden by adding a "." before the name. So the file test will appear in a file browser, whereas .test will not. Most people don't know that running the command ls -a will show hidden files and folders. So if you have folders or files you don't want your co-workers to see, simply add the dot to the beginning of the file or folder name. You can do this from the command line like so: mv test .test

3. A good password is a must
Your password on a Linux PC is your golden key. If you give that password out, or if you use a weak password, your golden key could become everyone's golden key. And if you're using a distribution like Ubuntu, that password will give users much more access than, say, on Fedora. To that end, make sure your password is strong. There are many password generators you can use such as Automated Password Generator

4. Installing file-sharing applications is a slippery slope
I know many Linux users are prone to file sharing. If you want to run that risk at home, that's your call. But when at work, you not only open yourself (or your company) up to lawsuits, you open your desktop machine up to other users who might have access to sensitive data on your work PC. So as a rule, do not install file-sharing tools.

5. Updating your machine regularly is a smart thing
Linux isn't Windows. With Windows, you get security updates when Microsoft releases them (which could be many months away). With Linux, a security update can come minutes or hours after the security flaw is detected. With both KDE and GNOME, there are update applets for the Panel. I always recommend having them up and running so you know when updates are made available. Don't put off security updates. There is a reason they come out.

6. Installing virus protection is actually useful in Linux
Believe it or not, virus protection in Linux has its place. Of course, the chances of a virus causing problems on YOUR Linux machine are slim to none. But those e-mails you forward to others' Windows machines could cause problems. With a good virus protection, like ClamAV, you can ensure that e-mail going out of your machine doesn't contain anything nasty that could come back to haunt you (or your company)

7. SELinux is there for a reason
SELinux (Security-Enhanced Linux) was created by NSA. What SELinux does is help lock down access control to applications. And it does it very well. Sure, SELinux can sometimes be a pain. In some cases, it might take a hit out of your system performance. Or you might find some applications a struggle to install. But the security comfort you gain using SELinux (or Apparmor) far outweighs the negatives. During the Fedora installation, you get the chance to enable SELinux

8. Creating /home in a separate partition is safer
The default Linux installation places your /home directory right in the root of your system. Sure, this is fine, but

  1. It's standard, so anyone gaining access to your machine knows right where your data is and
  2. If your machine goes down for good, your data might be gone.
To solve this problem, you can place /home on a different hard drive or partition all together (making it a partition in and of itself). This is not a task for the weak of heart, but it is one worth employing if you're uber-concerned about your data

9. Using a nonstandard desktop is worth its weight in gold
Not only do the alternative desktops (Enlightenment, Blackbox, Fluxbox, etc.) give you a whole new look and feel for your PC, they offer simple security from prying eyes you may never have thought of. I have deployed Fluxbox on kiosk machines when I wanted a machine that could do one thing: Browse the network. How do you do that? Simple. Create a single mouse menu (or desktop icon) for the application you want to use. Unless the user knows how to get back to the command line (by logging out or hitting Ctrl-Alt-F*, where * is a desktop other than the one you are using), they will not be able to start up any application other than the one offered. Since most users have no idea how to move around in these desktops anyway, they aren't going to have the slightest idea how to get to your files. Simple pseudo-security

10 Stopping services is best
This is a desktop machine. It's not a server. So why are you running services like httpd, ftpd, and sshd? You shouldn't need them and they only pose a security risk (unless you know how to lock them down.) So don't run them. Check your /etc/inetd.conf file and make sure that all unnecessary services are commented out


You might find these suggestions to be pure common sense -- but maybe you'll see a means of security you never thought of before. And if you're a new Linux user, these tips are a great place to start to ensure that your Linux experience is a good one.

Read more!

Thursday, December 13, 2007

Configuring a Samba Server

If you deploy a Linux-based machine to serve up files in a Windows network, you’re not going to get very far without the help of Samba. Samba is an Open source software suite that offers seamless file and print services to SMB/CIFS clients.

Basically, Samba can fool a Windows machine into thinking a Linux machine is a Windows machine. A bit of trickery yes, but it gets the job done.

Before YaST, the real trick was getting Samba to actually work. Configuring Samba required hand-editing the smb.conf file; this could be a nightmare. Now you can point-andclick your way to getting Samba running, because the good people at Novell and SuSE have worked hard to bring the Linux administrator the YaST (Yet another Setup Tool) to help. This tool makes setting up a plethora of system settings as simple as it gets. Here’s how it works.

What does Samba do?
Before we move on, let’s make sure we all know what Samba does. Samba’s magic happens thanks to a protocol suite known as the Common Internet File Sharing (or CIFS) at port 3020. At the heart of this protocol suite is the Server Message Block (SMB) protocol.

Samba is simply the open source implementation of the CIFS protocol suite. Samba allows Linux servers and workstations to talk to any Windows workstation, all the way
back to Windows 95.

Configuring Samba

To configure a Samba Server in SuSe Linux, you’ll use the YaST tool. To do so, go to the Control Center. Select Administrator Settings from the Common Tasks section to open the YaST Admin Tool. Next, select Network Services to reveal a listing of the various Network Services that can be configured from within YaST. Press the Samba Server button and you’ll see YaST’s Samba GUI.

The first thing you have to do is enter the domain to be configured. The drop-down is a bit misleading. The default, TUX-NET, is the only option available. Simply erase that option and enter your domain. Once you have applied this, press Next to take care of the final phase of initial setup.

If your server is to house all of the Samba log-in information, set it as the PDC.

This final phase requires you to decide if your Samba server will act as a Primary Domain Controller. Make your selection and press Next.

Once you press Next, you can’t come back to this portion of the setup without aborting the installation altogether. So make your choices wisely.

After you press Next, you are in the primary Samba configuration.

If you click Abort, the Samba GUI will go away.

The first configuration is the Samba startup status. You can either configure Samba to start at boot or to be manually started. I highly recommend you have Samba start at boot. It will slow your boot time down a fraction of a second, but it will lessen the tasks you must handle once the server is up and running.

Once you have Samba’s boot configuration taken care of, open up the firewall for Samba. Select the Open Port In Firewall check box. If your machine has more than one network interface, press the Firewall details button to apply the firewall changes to the correct interface.

The next step is to configure the proper Samba shares. Press the Shares tab, to reveal this configuration.

You can enable or disable a feature simply by clicking the Toggle Status button.

The Shares tab allows you to configure every aspect of the Samba shares. You can go beyond just enabling or disabling each share, of course. By highlighting a share and pressing the Edit button, you can further customize each share configuration.

Let’s take a look at configuring the users share. Highlight that share and press Edit. A new window reveals five pre-configured options.

Obviously, the default settings will not work for most, and there are a lot of possible options to add. Let’s take a look at the default options and what they are:

  • Read Only: Tells Samba if the configured shares are read only. The default is set to No. If users need only to be able to read data from the shares, highlight the option,press Edit, select the read only check box, and press OK. The share is now set to read only.
  • Comment: What users see after logging in. This could be a description of the server serving the shares.
  • Path: The directory that Samba will share out to the users.
  • Inherit ACLS: Means that all files within a parent folder will inherit the ACL(Access Control List) of the parent folder. That’s it for the default users options.
Obviously, there are quite a few more options to be added.

If you press the Add button, a small window will appear with a drop-down list. That drop down list contains 124 other options to add and configure. Once you find the option you want to add, select it and press OK. Some of the new options will have another configuration window to edit before the option is added. Say, for instance, you want to add admin users. Click the drop-down and highlight admin users.
124 options to choose from.

Press OK and the second window will open to enter the admin username.

When you press OK, you’ll be taken back to the initial shares screen, but the admin user will be listed among the options. After you have completed the configuration of this section, press OK to move on.

Another option in the Shares tab is to enable to users to share their home directory. This is important: If you enable this feature, every user’s home directory will be made available. If this server is used frequently by users, then privacy can become an issue. If you decide to use this feature, make sure your users are made aware of it.

Finally, the Identity tab, shown in Figure E on page 14, allows you to further specify the identity and role of the Samba server.

Your Workgroup or Domain name should already be correct from the initial configuration.

Two of the three configuration options should be familiar from earlier configurations. The final of the three, NetBIOS name is just the name the machine will be seen as on the shared network. If you want the server to be seen as “Department X” then enter Department X in this option.
You may also undertake some advanced settings from this tab. From the Advanced Settings drop-down, you can select either Expert Global Settings or User Authentication Settings. The Expert Global Settings, allow you to fine-tune settings for printing, security, and log-in.

When you press the Edit button, the majority of the options in the Global Settings configurations are text-field entries.

If you’re familiar with hand-editing smb.conf files, you’ll recognize a number of the configurations. One of the most important configurations you’ll make here is the security option. This is how your users will authenticate to your Samba server. There are five possible settings:
  • ADS: Where Samba acts as a Domain member of an Active Directory.
  • Domain: Where Samba relies on a Windows NT Primary (or Backup) Domain Controller to authenticate users.
  • Server: Where the Samba server passes the buck of authentication to another
  • Samba server.
  • Share: Where users only have to enter password if they try to enter a specific shared directory.
  • User: Where users are required to enter their username/password on a per Samba server basis.
The other Advanced Settings tab, User Authentication Sources, is simply a way for you to define where Samba finds the resource file to authenticate users. There are four different types:
  • smbpasswd File
  • LDAP
  • TDB Database
  • MySQL Database
Obviously, this configuration will depend completely on your network setup. The default option is smbpasswd File. If you press the Edit button (with that option highlighted), you can then enter the location of the password file used.

Make the connection

With all of these options complete, you are ready to complete the configuration by pressing the Finish button. This will save all of your configurations and start the Samba services. If your configuration is successful, you can now log into your Samba server from your Windows machines. Just connect to the Linux server from the Windows workstation in Explorer using the standard \\servername syntax.

Read more!

Tuesday, December 11, 2007

Configuring Linux using a GUI

Many hardcore Linux users would shudder at the thought of configuring Linux network services using a GUI. A solid argument could be made that a GUI has no place being on a server in the first place. Servers are just supposed to sit quietly in the corner and do their job by themselves without user interaction. GUIs, by definition, are designed to make user interaction easier. A GUI adds needless overhead to a machine that’s not supposed to be interacting with users from its own console. Therefore, you should keep a GUI off of the server and configure services to run from a command line.

Although it’s practically sacrilegious, using a GUI for configuring servers can make sense in some cases. Primarily, using a GUI can help network administrators who aren’t familiar with Linux learn to set up network services faster. Many network administrators come from a Windows background, where practically everything is point-and-click. Although they need to earn new tools, the old Windows skills can more easily be translated to Linux through GUI tools.

Even for seasoned Linux users, trying to figure out the locations, layouts, and choices of configuration files that need to be maintained can be a chore. Some services can use three or four different .conf files. A slight error in the file can cause the service to fail. If the error was overlooked, a lot of time can be lost to troubleshooting. GUI tools that automatically find and populate the corresponding .conf files can end confusion and decrease the chance of errors.

GUI configuration options
Linux gives you several options when it comes to GUI-based network administration. Since the distribution we’ve chosen to use in this series revolves around SuSE 10.2, the major GUI configuration tool you’ll use is YaST. Other distributions have their own tools, but YaST is very well-organized, with an easy-to-follow arrangement.

YaST does a lot, but it doesn’t do it all. For those services YaST can’t control, we’re going to use Webmin, an add-on tool which allows you to control Linux services from inside of a Web browser. This means you have to learn how to use another tool, but it’s still easier than doing configurations from the command line.

A quick look around YaST
Although it is contrary to what many Linux admins would advise, I’m going to log into my SuSE 10.2 machine as root for this setup. I don’t do this often, but it saves me from having to enter the root password each time I perform an administration task.
Once you are done setting up these services, log out.

The first thing you’ll want to do is to select the Computer menu

The new GNOME 2.16 menu is quite a change from the usual cascading menu.

From the menu, select Control Center.
The Control Center is grouped in both Groups and Common Tasks.

From the Common Tasks section, select Administrator Settings to open the YaST
Admin Tool. You’ll see a screen similar to the figure below

It should be obvious that Network Services is your next destination.

Select Network Services to reveal a listing of the various Network Services that can
be configured from within YaST.
A nice collection of GUI tools to help you configure your Linux server.

Working with Webmin
There are a number of ways to go about the installation of Webmin, but the easiest and most consistent method of installing Webmin is from source. To get the source tarball, go to sourceforge site for the latest release. Once you have that file downloaded, you are going to untar the archive with the command tar xvzf webmin-1.310.tar.gz.

Now cd into the newly created webmin-1.310 directory. Inside this directory is the setup script to install Webmin. From within this directory, run the command ./setup.sh /var/www/html/webmin (where /var/www/html/webmin is the directory you wish to install
Webmin into).
Note: The /var/www/html/webmin directory does not have to exist, because the Webmin setup script will create it for you.

While the installation script is running, it is going to ask you the following:
  • Webmin configuration directory
  • The location at which Webmin will store logs
  • Path to Perl
  • Your server OS (Webmin tries to detect this)
  • The port Webmin will run on (defaults to 10,000)
  • The username and password to log in to Webmin
  • Your server’s hostname (Webmin tries to detect this)
  • SSL usage; should only prompt if Perl’s SSL libraries are installed (this author has not run Webmin under SSL)
  • Whether you want Webmin to start with system boot (highly recommended)
An interesting gotcha: During installation on Fedora Core 6, I was only asked for the installation directory. I was not prompted for a password, server hostname, server OS, port number, path to Perl, or SSL usage. Initially, it caused many an eyebrow lift when I logged into the site without an admin password.

I tried using the root username and password for my system; it worked. I attribute
this to Webmin being previously installed (but not run) via RPM. After the installation
script completed, it informed me:
Webmin has been installed and started successfully. Use your web browser to go to
http://localhost.localdomain:10000/
and login with the name and password you entered previously.
Because Webmin uses SSL for encryption only, the certificate it uses is not signed by one of the recognized CAs such as Verisign. When you first connect to the Webmin server, your browser will ask you if you want to accept the certificate presented, as it does not recognize the CA. Say yes.
The directory from the previous version of Webmin /usr/libexec/webmin Can now be safely deleted to free up disk space, assuming that all third-party modules have been copied to the new version.


The last section of the presented information was a good hint as to why I was not given the chance to set up an admin.
Now that Webmin is installed, it’s time to take a peek around and see what it has to offer.

Logging in
As stated above, you may have to log in with your root username and password.
Once logged in, you will be greeted with the Webmin main page.

Webmin’s main administration page.

From there, the first place to visit is the Webmin Configuration screen.

Here you can configure Webmin options.

Security configurations
From within the Webmin configuration screen, there are a number of items you will want to set up. Obviously, security for such a tool is high on the list. Select the IP Access Control link to set up a list of allowed or denied hosts; this prevents password guessing. You may have set up a rigid password that’s a mixture of alpha and numeric characters (as well as upper and lower case), but eventually someone’s going to crack it.

To add one more layer of security, set up this list so you allow only specific IP addresses to access the tool. Make sure you include any known safe IP address that will be needing access to the Webmin interface. All other hosts are denied.

Along this same line of security, select the Trusted Referrers link. From here, you can configure Webmin’s referrer-checking support, which ensures that malicious links from other sites cannot trick your browser into doing dangerous things with Webmin. In this section, there is a text area where you can enter trusted sites, a radio selection, and a check box. The radio selection allows you to choose to Enable Referrer Checking, and the check box allows you to select to Trust Links From Unknown Referrers.

From everything I’ve read and experienced, the default configuration for Webmin is pretty secure. For those working with mission-critical servers, however, it might befit you to uncheck the Trust Links From Unknown Referrers box, and configure some trusted Web sites.

The next step in securing Webmin is enabling the system to use SSL tunnels; this will allow remote login without passing unencrypted passwords across the ether. However, there are steps that must be taken before this feature can be used. First, OpenSSL must be installed; on many newer distributions, this is already taken care of. If not, then download the most recent OpenSSL from rpmfind and run the command (as root) rpm -ivhopenssl-XXX.rpm (where XXX is the release number).

With OpenSSL installed, you must install the Net::SSLeay Perl module. Download this module from the Net::SSLeay site, untar the archive with the command tar xvzf Net_SSLeay.pm-XXX.tar.gz (where XXX is the release number), change into the newly created Net::SSLeay directory, run the command perl Makefile.PL, and run the command make install.

To test the installation, run the command:perl -e ‘use Net::SSLeay’. If no errors are reported, you are good to go.

Select the SSL Encryption link from within the Webmin Configuration page, and you should see the following text, indicating SSL is working properly:
The host on which Webmin is running appears to have the SSLeay Perl module installed.

The first thing you want to verify is whether Enable SSL If Available? is checked. If it is, then you should now be able to log in to your Webmin site with the URL https://localhost.localdomain:10000/.

Your Webmin login is now encrypted.

Webmin users
Creating Webmin users is a very important task and should not be taken lightly. It’s necessary to grant users access to various aspects of your Webmin server (especially if your company’s server farm can not be administered by one person alone).

However, as in any good UNIX environment, users should be created and maintained wisely. To make this an easier task, I suggest creating groups to suit your needs. Say, for example, you have an IT team that needs access to the Webmin interface. From the Webmin main menu, select Webmin Users. Inside this page, Webmin Groups can be administered. Select Create New Webmin Group to create a new group.

From the list of options, select which modules the IT group needs to have access to, and press Save. Now, go to the Create Webmin User section, and create a new user. During this configuration, select the IT group from the Member Of Group list. There are some nice configuration options here, such as allowing users access to the site only on given days and times. Once you Save, the user will be created, and the user will inherit all of the options from the IT group.

Read more!

Wednesday, December 5, 2007

How to Overcome multimedia hurdles in Linux

For many, one of the biggest hurdles preventing them from adopting Linux is the difficulties that arise when it comes to dealing with multimedia. In most cases, the Linux multimedia experience is still not like Windows or OS X, where you can click on a file and the player just opens and plays the video or audio clip. In the Linux world, you need to ensure the proper software is installed. When everything is in the right place, the magic will happen.

What's the problem?
Unfortunately, getting the magic to happen isn't always as simple as we'd like it to be, but it's not impossible. In some instances with certain players, getting files such as WMV files is quite simple. In others, however, it can be a nightmare. However, even the nightmare has come a long way from the days of trying to get Windows Media Player to work with Wine. Now it's as simple as getting MPlayer or Totem to work with the correct codecs (devices that enable either the encoding or decoding of a digital signal). It is with these codecs that Linux is given the ability to play audio and video files; they are not typically installed by default, so the codecs enable Linux to play files that were historically only playable with the Windows Media Player (or another Windows equivalent).

Before we get into codecs, I'll introduce the major players in the Linux multimedia party.

MPlayer

MPlayer (Graphic Minimalistic Player) is one of the more popular -- but not the best -- media players for Linux. MPlayer has been around for a while; near the beginning of its existence, it looked as if it was destined to be the standard for Linux multimedia.

However, something happened along the way, and the bugs started flying on an apocalyptic scale. Like all good open source applications, the bugs were squashed; but unfortunately by this time, better players had popped up on the market (more on these later). MPlayer isn't worthless; I still use MPlayer for many files. For me, it's been easier to resolve many problems with MPlayer than with other applications.

Installing MPlayer is simple: on a yum-based system, run the command (as root) yum install gmplayer; on an apt-get based system, run the command apt-get install gmplayer. Once MPlayer is installed, you can run the player either from the Sound And Video menu (GNOME start menu), or from the KDE Multimedia entry in the start menu. Once the player is open, you'll see something similar to Figure

The out-of-the-box MPlayer GUI is certainly user friendly.

There's very little to explain about MPlayer that the average user won't be able to figure out. There are, however, some things to note. First, ensure that you're using the correct audio and video drivers. Figure shows the configuration screen for the video drivers.

You'll configure everything you need for MPlayer from this window.

The video driver you use must work with the drivers installed for your video card. If you don't have a gl-compatible video card (or a lower-end card) and you select a gl-based driver, your machine could come to a screeching halt. If you're not sure which driver you're using, take a look at your xorg.conf file (as root) and check the "Device" section; this will look similar to:

Section "Device"

Identifier "Videocard0"

Driver "nvidia"

Option "HWcursor" "false"

The line to look for is the Driver line. In my case, I'm obviously using the nvidia driver. Another thing to notice in the xorg.conf file is the presence of the glx -- or GLCore --modules in the Modules section. If there are no lines in the Modules section to load the gl-related modules, then using a gl-based driver would be a bad idea. Instead, stick with the safer xv default.

A configuration in MPlayer that always bothers me is that the video window shows even when there's nothing playing, leaving an extra window open. From within the Misc tab of the MPlayer configuration window, you can deselect this option. Another small issue: When you change a configuration, you have to restart MPlayer for the configuration to save.

VLC
VLC (VideoLan Client) is quickly becoming one of the most popular Linux video playback applications. (Note: Of all the multimedia applications I have used, VLC is by far the best.) VLC is a cross-platform system; there are binaries for Linux, Windows, and OS X. VLC supports a huge amount of file formats; probably the most of any player, no matter the platform.

Installing VLC is as simple as any other applications. With a yum-based distribution, run the command yum install vlc and with an apt-based distribution run the command apt-get install vlc. Both package managers will pick up the dependencies and install the system.

Running VLC can be done from either from the command line by running the command vlc or from the KDE Multimedia menu or from the GNOME Sound And Video menu. When you run VLC, you'll only see a small window, shown in Figure, from which you do everything.

To open a file, press the button that would normally serve as the Eject button.

A nice feature with VLC is that the equalizer actually works and works real time. To open the equalizer, press the Equalizer button on the main VLC window, as shown in Figure.

The EQ button is easy to miss.

Once the EQ is open, you first have to enable it by pressing the Equalizer Status button. You'll see this in Figure.

You know it's on if the buttons are glowing blue.

Simply move the sliders associated with the frequency you want to change.

VLC is also outstanding at playing music. You can create playlists by opening the playlist window, adding files, and saving the playlist (you can also do this with video). VLC can also serve as a DVD player as well.

XMMS

For a long time, XMMS reigned as the king of MP3 players on Linux. Known as Winamp on the Windows platform, this player was (and is) an outstanding means for playing various file formats.

However, once the MP3 file format became restricted, no Linux distribution would ship with MP3 support included. So if you want to play MP3 files on your Linux distribution, you'll have to roll in support for it. To do this for XMMS, follow the subsequent steps.

With a yum-based distribution (as root), run the commands:

yum install xmms-mp3

This should get the matching xmms-mp3 file for your already-installed XMMS installation. If it complains that the files aren't the same, remove it with yum remove xmms, and then run the command:

yum install xmms xmms-mp3

You should now be good to go.

With apt-get, you should be able to do this with the command:

apt-get

install xmms xmms-mp3

The XMMS application should be self-explanatory.

Totem
Totem is the default multimedia player with any GNOME-based distribution; this is an issue for many, since Totem seems to wince at playing nearly anything. Even with all the codecs in place, Totem can not play popular file formats, such as WMV files. That's too bad, because Totem is actually quite a good player. However, with the installation of a simple plug-in, you can at least get Totem to play MP3 files. To do this, issue (as root) the command:

yum install gstreamer-plugins-ugly

or

apt-get install gstreamer-plugins-ugly

I've only managed to get Totem to read WMV files on an Ubuntu 7.10 installation. By installing the codecs as you would for any of the players, it works, but only on Ubuntu. I have had no luck with Fedora.

Codecs
There are a number of files that need to be installed for this method; after all, we're installing files to help support different file formats for numerous players. However, this process has been made simple by standardization.

In order to get the necessary codecs, visit the MPlayer site and download the binary codec package. The file will be in a BZ2 format, so you'll have to run the following command:

bunzip2 essential-XXX.tar.bz2

where XXX is the actual release number.

Now unpack the file with:

tar xvf essential-XXX.tar

where XXX is the actual release number.

Now cd into the newly created directory and, as root, issue the command:

cp * /usr/lib/codecs/

Now your multimedia players will support the once-dreaded WMV format in Linux.

What about Firefox?
Getting multimedia support in Firefox really isn't difficult. If you visit the Common Plugins for Firefox page, you'll see all the necessary plug-ins (along with installation documentation).

Command-line players
I would be remiss if I didn't at least mention that there are numerous command-line players for multimedia. Let's visit the short list:
  1. mplayer: The command-line version of MPlayer (the GUI command is actually gmplayer). To open a media file with this command, simply run mplayer FILE_NAME. If the file is a video, a new window will open with only the video playing. If the file is an audio file, no other window will open. This command is helpful if you need it to be executed in the background by another application.
  2. mpg123: This application is quite useful; it can play as well as convert audio files. If you want to create a playable CD from a collection of MP3 files, you can issue the command mpg123 -w FILENAME.wav FILENAME.mp3, and the resulting WAV file is ready for you.
  3. play: The play command allows you to play WAV and MIDI files in the background. Like mplayer, play is useful for running sounds in the background. I have used play in conjunction with Procmail to play various sounds for different incoming email, which is very handy.

At one time, it was thought that Linux would take a sideline to any other OS when multimedia is concerned, but times have changed: Linux is now a real player in the multimedia sector. Of course, that is not to say there aren't pitfalls: many times, I've come across a site that won't support Linux (even though the file format they stream is supported in Linux, i.e., abc.com).

I remember a time that getting all the necessary multimedia support up and running was a real chore. Now, out of the box, it's all there for you (with the exception of MP3 support, but that's another issue altogether).

If your issue with Linux is multimedia, it should be obvious that it's no longer a problem, so don't think twice about giving Linux a try.

Read more!

Thursday, November 22, 2007

Get familiar with alternative Linux desktops

Linux has proven amazingly flexible: after nearly 10 years of use, I'm still impressed by how the Linux operating system does exactly what I want on any type of hardware. Desktop customization is no exception; from the ultra-modern KDE and GNOME window managers to with the likes of Fluxbox and AfterStep, there's a Linux desktop to suit everyone.

Like the majority of window managers (WMs), Fluxbox and AfterStep work on most Linux distributions. Your particular distribution may not have additional WMs in their base packages, so you may need to download additional files to get them to work. The environment I'll be using is a fresh install of Ubuntu 7.0.4 (Feisty Fawn) with the following (significant) specs:

  • AMD 2800+ processor
  • 528 MB of RAM
  • Via Technology integrated VT8378 video

Obviously this machine is no powerhouse, but these alternative desktops do not require much iron to run them faster than a KDE, GNOME, OS X, or Windows desktop on a machine twice as powerful.

A bit about window managers

A fundamental difference between KDE and GNOME and alternative WMs is that desktop environments such as KDE and GNOME are fully-integrated environments, which means that they include many applications that also depend upon a WM to draw windows for them. A WM, on the other hand, only draws windows and menus, and so on. A WM by itself is smaller, faster, and lighter, but less powerful in most cases.

Essentially, a WM is perfectly suited for less powerful machines or users that do not want the bloat of a full desktop environment (DE).

None of this is to say that a WM is less usable; in many instances, a WM is the simplest of all GUIs to use. Their simplicity makes them absolutely perfect for people who have trouble getting around the sometimes complex world of a full DE.

With that in mind, let's take a look at two very nice WMs.

Fluxbox

Fluxbox is based on Blackbox. The Fluxbox developers saw that Blackbox had seriously stagnated and wanted to see it come back to life, so they helped it out by improving the code, adding features (some of them amazing), and planning ahead. Here's the list of current features:

  • Configurable window tabs
  • Simple Icon Bar (for minimized and iconified windows)
  • Multiple workspaces
  • Configurable titlebar
  • KDE support
  • New native integrated KeyGrabber (with support for emacs like keychains)
  • Partial GNOME support
  • Extended Window Manager Hints support

Ahead for Fluxbox:

  • Session Management
  • Windows Snapping
  • Configurable toolbar

Let's view what Fluxbox really looks like.It shows the basic Fluxbox desktop using the Spiff style. A total of 22 styles come with Fluxbox, so you have many other looks to choose from.

As you can see, there are shaded windows open, a mouse menu, and the toolbar.

Let's take a look at the individual components. The first is the toolbar, a fairly minimalistic tool; basically, this is a bar where applications appear, whether they are minimized or not. Other things on the bar include the workspace switcher and a clock; each item can be configured via a right-click on the toolbar. When you right-click the toolbar, you'll see the menu shown in the figure

You can hide the toolbar from this menu by selecting Hide.

Here are the toolbar configuration descriptions:

  • Auto Hide: Auto-hides the toolbar when it is not being used.
  • Toolbar width percent: The percentage the toolbar takes up.
  • Maximize Over: When enabled, maximized windows will cover the toolbar.
  • Layer: The layer of the desktop the toolbar will be on.
  • Placement: Location of toolbar.
  • Alpha: Transparency of the toolbar.
  • Iconbar Mode: The iconbar (within the toolbar) settings.
  • Clock: Format of the clock.
  • Edit Clock Format: Customize the clock format.

Aspects of the toolbar that can not be configured via the toolbar are the workspace names. A workspace is basically a desktop, and the Linux desktop is capable of having multiple desktops. By default, Fluxbox has four workspaces. To configure the workspaces, middle-click the desktop; this brings up the Workspace menu.

When you bring up the Workspace edit menu and select Edit Workspace Name, a small text area will appear where you enter the new name of the workspace. Now that you've renamed the workspace, it shows up on the toolbar, as shown in the figure.

Keep the names short if possible.

Fluxbox Menu

One of the drawbacks (for users at least) is that the Fluxbox Main Menu must be hand-edited in a text editor. By default, the menu to edit is /etc/X11/fluxbox/fluxbox-menu. You need root access to do this. To make this easier, copy this menu to the user's ~/.fluxbox/ and rename it menu.

A typical menu entry looks like this:

[exec] (OpenOffice.org Writer) {/usr/bin/oowriter}

Here's the breakdown of the entry.

  • [exec]: Tells Fluxbox this is a command.
  • (OpenOffice.org Writer): What the entry will be named in the menu.
  • {/usr/bin/oowriter}: The actual command (must be inside of {}).
  • : The location of the icon image.

What good is just adding a bunch of entries into the menu without categorization? Let's break it down into submenus. Suppose you want to have a group of tools for the Internet. Here's what that would look like:

[submenu] (Internet) {} [exec] (Evolution) {/usr/bin/evolution} [exec] (Firefox Web Browser) {firefox} [exec] (Gaim) {/usr/bin/gaim} [end]

As you can see, individual entries are bookended with the [submenu] (NAME OF SUBMENU) {} [end]. The brackets are empty because there's no command to execute.

Tabbing together Windows

Even though Fluxbox isn't as robust as other environments, it does have some cool features. Tabbed Windows is one of those little features you wish every desktop could have. Check out the figure:

You can't see the X-term because of the A-term.

If you kept opening shells, you could wind up with a mess on your hands. Fluxbox, however, fixes that. If you right-click the little tab at the top left of the titlebar and drag it so that it is on top of the tab of a window you'd like it to join, those two windows will be linked together and function similarly to tabbed browsing in Firefox.

It doesn't matter which applications you join together. If you look carefully back at Figure D, you will see a titlebar with three tabs, one of which says "techrepublic_". Two of those are browser windows, and the final tab is this article, which I am writing in OpenOffice.org Writer.

AfterStep: A step back in time

When I began using Linux, my first experience was with Fvwm95. Although this was somewhat familiar, it was a bit on the ugly side'; since I've always been fond of aesthetics, that particular window manager didn't suit me. My search for an eye-pleasing GUI brought me to AfterStep -- based on the look and feel of the NeXTSTEP interface -- which was growing popular with the Linux crowd. It was special because it was doing things most other desktops weren't doing. AfterStep was a far cry from anything the general public had seen.

Unfortunately, AfterStep became a victim of its own uniqueness. Take a look at the figure : As you can see, there are a lot of elements on the desktop.

It's pretty, but there are a lot of elements, which could confuse a new user.

Included in the default desktop:

  • The Wharf (bottom-right vertical and top-left horizontal, under the winlist of Figure E): A free-floating application launcher that can contain menus and applets, as well as applications.
  • Winlist (top): A small toolbar that holds icons for minimized and maximized applications. This is the fastest way to switch between applications.
  • Icons (bottom-left): These are not standard icons. When an application is minimized without having been switched via the winlist, the application will minimize to a small icon. To open the application, click the icon.
  • Pager (top-right vertical): Where you switch between desktops.
  • Menu (center): To get the application menu, click the left mouse button.

I've always tended to use AfterStep with a minimal amount of components. To get rid of the pieces you don't want, you have to hand-edit the /usr/share/afterstep/autoexec text file. In that file, you'll see entries that look like:

Module "I" WinList
Wait "I" WinList
Module "I" MonitorWharf
Wait "I" MonitorWharf
Module "I" Wharf
Wait "I" Wharf
Module "I" Pager 0 3

In order to disable a feature you don't want, comment the feature out, like so:

# Module "I" WinList
# Wait "I" WinList
# Module "I" MonitorWharf
# Wait "I" MonitorWharf
# Module "I" Wharf
# Wait "I" Wharf
# Module "I" Pager 0 3

After disabling all the desktop elements, changing the theme, and adjusting the color scheme, I have a throwback AfterStep desktop, as shown in the figure.

Nothing but a mouse menu and minimized icons: A minimalist's dream.

Mouse menus

Let's take a look at the three mouse menus available. The left-click menu, shown in the figure, is the primary menu. This menu opens up applications, configures the desktop, exits from the session, and gets you help with AfterStep.

A neat feature: press on the push-pin icon to keep the menu open while working.

The middle-click menu gives you a number of options to enact upon windows. This menu allows you to select an action (Kill, for example) and then select the window you want to act upon to run the command. So if you're having problems with Firefox, middle-click the desktop. You'll then see a menu similar to the one in the figure. Select Kill and then click on the Firefox titlebar to kill the application.

Need to kill a window? This figure shows you how.


The right mouse menu acts as the winlist -- a list of running applications -- as shown in the figure.

Even if an application is minimized, it will leap up to the front if selected from the winlist menu.

In order to alter the AfterStep application menu, you're going to have to hand-edit text files. Unlike Fluxbox, however, AfterStep requires the manipulation of multiple files. Take a look at the /usr/share/afterstep/start directory; you should see something similar to what's shown in the figure.

The only thing you will not see in your default start directory is the 1_aterm entry (that was my doing).

As you can see, there are both files and directories. The files act as single menu entries consist of one or two-line menu entries that look like:

Exec "aterm" exec aterm -tr -fg white -bg blue +sb & MiniPixmap "mini-app.xpm"

The entry is broken down in nearly the same way as the Fluxbox menu entry:

  • Exec: The name of the entry follows this.
  • "aterm": The name of the entry.
  • exec: The actual command follows this.
  • aterm -tr -fg white -bg blue +sb: The actual command.
  • &: Tells the system to run the command, but give the prompt back.
  • MiniPixmap: The mini icon used for the menu entry follows this.
  • "mini-app.xpm": The actual icon for the entry.

In the same start directory, you'll find subdirectories. Each subdirectory serves as a submenu within the main menu. Inside of each subdirectory are files for each application needed for the subdirectory. If you look into the 0_Debian menu (the main application menu) you will see nothing, until you look for the hidden file called .include. In this file is a pointer to the /var/lib/afterstep/menu/Debian directory. Within that directory, you'll find all of the application's menus and submenus.

Read more!

Friday, October 19, 2007

Enlightenment - An easy-to-use Linux GUI

In the 10 years I've been using Linux, I've run the gamut of window managers and desktop environments: FvWM, FvWM95, ICEWM, AfterStep, BlackBox, KDE, GNOME, Beryl, Fluxbox, CDE, XFCE, Windowmaker, Sawfish, Metacity, WM2, as well as Compiz. But it seems that no matter how many times I try another Linux GUI, I always go back to Enlightenment. It is one of the few PC GUIs that actually makes complete sense. It's lightweight, flexible, and reliable. It does its job well and doesn't try to do things it shouldn't. And it can look really, really good.

Before we discuss Enlightenment, let's break apart the Window Manager/Desktop Environment issue: which does what; what are they; why do we need them?


X Windows and the Window Manager

On top of the base of the Linux system, you have the X Window System. This system is a portable, network-transparent system that, by itself, can't do much. If you were to start up the X Windows System (with the command X), you would see a nice gray screen with a big X cursor. That big X cursor can move around, but that's it; you can't click anything or open anything. But X is critical: It is the underlying framework that allows the Window Manager to do its thing.

The Window Manager sits on top of X and draws windows, menus, and buttons, etc. The Window Manager is the piece of the puzzle that allows users to interact with their machine.

One of the best aspects of this setup is that the user is not limited to a specific environment. As a Linux user, I can place on top of X any type of Window Manager I desire. If I want something that looks like Microsoft Windows, I might run KDE. If I want to run an environment similar to OS X, I could run (and modify) GNOME. Or, if I want something all together different, I could opt for any number of choices, and it is one of those other choices to which I am going to introduce you.

Enlightenment: A bit of history

Enlightenment -- sometimes referred to simply as "E" -- was started by Carsten Haitzler (aka Raster). Enlightenment began in 1992 and was originally based on FVWM2. It was soon completely rewritten and forked into E16 (still used as the stable release) and Enlightenment DR17 (the development release). As of 2007, DR16 is in the DR16.8.9 release. Soon DR17 itself should wind up in a stable release. Enlightenment depends heavily on the Imlib library, which has been taken over by the GNOME foundation.

Why you should use Enlightenment

There are numerous reasons to become an Enlightenment user:

  • You need a GUI on an older machine that is not powerful enough to run the more resource-intensive KDE or GNOME.
  • You want something a little different.
  • You want to control users so they only have access to certain applications.
  • You want a GUI that is stable, fast, and flexible.

Those reasons may not be show-stoppers, nor will they see IT departments migrating hundreds or thousands of desktops to Enlightenment, but the small list above is reason enough to have many making the switch from their typical GUI to E.

Installing Enlightenment

There are a number of ways to install Enlightenment. You can search for an RPM that works with your appropriate Linux distribution, although this can be difficult and you may not get the latest version of Enlightenment if you do so. Often, RPM builds lag behind the latest versions. If you prefer using RPM, you can download all the necessary RPM files, place them in a directory, and run (as root) the command rpm -ivh *rpm to install Enlightenment.

You can also go the source route by downloading the following files from the Enlightenment SourceForge Site:

  • e16
  • e16docs
  • e16themes
  • e16utils
  • epplets
  • imlib2-src

You will have to install imlib2-src first. Download that tarball and open a console window. As root, unpack the tarball with the command tar xvzf imlib2-XXX.tar.gz (where XXX is the release number). Now change into the newly-created imlib2 directory and run the following commands:

./configure
make
make install

Once imlib2 is installed, you can start installing Enlightenment. You will start with the e16 tarball. Unpack that and then run the same commands to install it that you did for imlib2. Once you are done with that do the same for the rest of the downloaded files.

Now what?

If you are starting your X session from a console based log in you will need to create a .xinitrc file with the following contents:

exec e16

With that file saved, you simply have to run the command startx to start up Enlightenment. If you run one of the graphical logins (GDM or KDM) after installation, there should be an entry for the Enlightenment session.

When you first run Enlightenment, you will be greeted the default desktop, as shown in Figure A.

Figure A

The default Enlightenment desktop.

What you see on the default Enlightenment are three items: The Dragbar, the bar at the top; the Pagers, the squares at the bottom left; and the Icon box, at bottom right.

The Drag Bar

The Enlightenment Drag Bar is a tool that helps you navigate between desktops or applications (depending on which mouse button you press). If you have more than one application open, and you press the middle mouse button (usually the mouse wheel), you will see a list of open applications, similar to the ones in Figure B. You can then select which application you want to work with, and that application will have focus.

Figure B

This window is also called the Window List.

If you are familiar with Linux' desktop pager metaphor, then you will certainly appreciate yet another way to move between desktops. Figure C illustrates the right mouse button's click on the Drag Bar, which shows the list of desktops available.

Figure C

Simply select the desktop you want and you will be magically transported.

I find the Drag Bar to be mostly redundant; between key-combinations and the Pager system, it is unnecessary. In fact, I almost always disable it first thing to gain the extra screen real estate. We'll discuss disabling this later in configuration.

The Pagers

Located in the bottom left of the screen are the desktop Pagers. These boxes will transport you to which ever desktop you click on (Desktop 1 is the top pager; Desktop 2, the bottom). These pagers will also give you a thumbnail of the applications running.

Of course, there are other ways to zap between desktops. One such way is to scroll the mouse scroll wheel up or down to send you between desktops. We'll discuss the other in a moment.

The Iconbox

The Iconbox is simply a placeholder for when an application is iconified (in Windows-speak, minimized). An iconified window changes from the actual window to a small icon on the desktop. This is a Linux metaphor that has been around since the days of NextStep. Figure D shows the Iconbox with two iconified applications.

Figure D

The slider at the bottom of the Iconbox is helpful when you have more iconified applications than the Iconbox will show.

The Menus

There are three distinct menus with Enlightenment: The Main Menu, the Application Menu, and the Settings Menu. You can access these menus by pressing a mouse button anywhere on the desktop (as long as that space is unoccupied on the desktop).

The Main Menu, shown in Figure E, includes the Applications menu, but also includes a few system entries (for getting help, logging out, and restarting, etc.), as well as entries for settings. It is basically all of the menus wrapped up into one.

Figure E

There are redundancies in the menu hierarchy.

The Applications Menu, shown in Figure F, strips away all of the settings from the Main Menu and leaves behind applications and session (logging out and restarting) entries.

Figure F

If your system has GNOME or KDE installed, Enlightenment will include their menus in the Application menu listing.

The Settings Menu, shown in Figure G, is just as it would seem: it includes all of the settings required for Enlightenment.

Figure G

There are a large number of settings you can play with in Enlightenment.

Configuring Enlightenment

From within the Settings Menu, select the Enlightenment Settings entry. As seen in Figure H, you can control every aspect of the Enlightenment Window Manager.

Figure H

As you press on a button (left side), a new listing of settings will appear (right side).

Many of the settings will be self-explanatory. Others, if you are familiar with Linux concepts such as Focus, Desks, or Pagers, etc., will also be familiar. Some of the settings, however, are unique to Enlightenment. One such setting is Groups. The Groups setting deals with placing applications together in groups for such configurations as border style (all applications of a group having the same border style) and iconifying (all applications in a group will have their icons grouped together in the Iconbox). Basically, whatever you do to one window in a group, all windows in that group will reflect that same change.

Now, to set a windows group, you must access an entirely different menu. From a Windows titlebar, press the right mouse button. From here, a new menu will appear that allows you to affect the window of that application.

First, select the Start A Group menu entry. It will appear that nothing has happened, but actually the window you selected this menu entry on will be the base for the group. Suppose you selected the Start A Group entry on a window containing The Gimp. You will then have a group called The Gimp. You can add any window (say, all windows containing applications that deal with graphics) to that group. Once you have a group created, you can then affect the windows (and their behavior) in that group.

That same menu (from right-clicking the title bar) allows you to pull off a few other nifty tricks. The tricks will, of course, be dependent upon the theme you are using. Some themes allow you to set the titlebar to the right or left. This setting makes for a very interesting look. Combine this with transparency (and the right theme) and you'll have something like that shown in Figure I.

Figure I

This is a desktop sure to impress your friends and co-workers.

Menu configuration

One of the few drawbacks to Enlightenment is the configuration of menus. There is no tool for this task. Instead, you have to actually edit a text file. Although this might seem like a throwback, it's actually quite easy to do.

The file you need to edit will be in the users ~/.e16/menus/ directory and will be called user_apps.menu. The individual entries for the menu look like this:

"Open Office" NULL exec "oowriter"

Breaking this entry down looks like this:

  • "Open Office" is the name that will be listed in the menu.
  • NULL is the graphic entry for the menu (NULL being no graphic).
  • exec tells the system that what follows is the command for the application.
  • "oowriter" is the actual command for the application.

You can have as many entries as you like.

Key combinations

As with all Linux desktops, there are certain key combinations that will allow you to work more efficiently. These key combinations include:

  • [Alt][Ctrl][Home]: Auto arrange all open windows
  • [Alt][Ctrl][Insert]: Launch the Eterm application
  • [Alt][Ctrl][Delete]: Log out of Enlightenment
  • [Alt][Ctrl][Right]: Go to the next desktop
  • [Alt][Ctrl][Left]: Go to the previous desktop
  • [Alt][Shift][Down]: Move desk area down
  • [Alt][Shift][Up]: Move desk area up
  • [Alt][Shift][Left]: Move desk area to the left
  • [Alt][Shift][Right]: Move desk area to the right
  • [Alt][Tab]: Switch between applications
  • [Alt][Ctrl][Up]: Raise active window
  • [Alt][Ctrl][Down]: Lower active window
  • [Alt][Ctrl][X]: Close active window
  • [Alt][Ctrl][K]: Destroy active window
  • [Alt][Ctrl][I]: Iconify active window
  • [Alt][Ctrl][R]: Shade active window
Final thoughts

Enlightenment is one of the finest Window Mangers for Linux. Not only is it effective in making your work efficient, it is also full of eye candy you may never have experienced before. You can even pick up some really great themes for Enlightenment (placing them in /user/share/e16/themes will get you started). Whether it's giving life to an older machine or perking up your rather drab computing experience, Enlightenment will help you get a fun Linux desktop.


Read more!