Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


November 2004

A Linux Primer for Windows Administrators

Clueless about Linux? This guide to the essentials can help you get your bearings
RSS
Subscribe to Windows IT Pro | See More Linux Articles Here | Reprints
Or get the Monthly Online Pass—only $5.95 a month!
SideBar    Linux's Online Help, IT Saves the Data Center with VMs

User Groups
In Linux and Windows, groups can greatly facilitate administration because they let you configure permissions for a set of users rather than many individual users. You define groups in Linux as you define users, within a single file—but for groups the file is /etc/group. Table 2 shows the contents of /etc/group. The format for an /etc/group entry is

group-name:password:GID:member1,
member2,...

The following entry is commonly found in Linux etc/group files:

sys::3:root,bin,adm

In this listing, the group name is sys, the group ID (GID) is 3, and the users root, bin, and adm belong to the group. (Again, like Windows, Linux uses numbers internally to represent actual objects such as users and groups and lets users reference those objects by using symbolic names, such as sys.) Notice that the sample /etc/group entry has no password field. Most groups in the /etc/group file don't have a password. In general, you can ignore the password field; however, you must place a field separator character (a colon—or :) in the password position even if you're not specifying an actual password.

To add a new group, you use the groupadd command. For example, to create the students group, you'd enter

# groupadd students

which creates the following entry in /etc/group:

students:x:700:

After you add a group, you can add users to it as you would to any other group. To add users to a group, you can either manually edit /etc/group or run the usermod command with the case-sensitive −G option, like this:

# usermod jdoe -G students,users

After you've created groups, you should apply group ownership (i.e., use commands to restrict access to certain directories by group) to the directories that you want to control. You do this by using two commands—chgrp and chmod—which I discuss later.

Deleting a group is similar to deleting a user. To delete a group, you use the groupdel command and specify the group you want to delete. For example, to delete the newly defined students group, you'd enter

# groupdel students

Before you delete a group, you should determine whether the group is currently being used by the system or by regular accounts. If so, you must first make sure that all users in the group have updated their file-ownership information to another group, if necessary.

The Linux File System
Linux and Windows both abstract the file system interface between the kernel and hardware by using file system drivers. This abstraction lets the kernel provide a standardized interface that can easily be modified to support newer technologies. (Linux actually provides access to both old and new file systems, including the Linux ext2 and ext3 file systems and DOS FAT, among others.) In general, you don't need to worry about the mechanics of how Linux stores and retrieves data from disk. However, you do need to know how to mount file systems (that is, make them available to users) and how to check and repair damaged file systems. In addition, you should have a good understanding of how to apply permissions to directories and files.

When you mount a file system in Linux, you attach it to the root file system so that users and applications can access it. Until you mount the file system, you can't access the files that are located in it. This procedure differs from Windows in that when Windows detects a disk with a known file system type, it immediately makes the disk available as a lettered drive. (Windows Server 2003, Windows XP, and Windows 2000 Server also support mounting file systems, so that you can extend the size of a current lettered drive by mounting a new disk on a directory on that drive.)

To mount a file system, you use the mount command, for example:

# mount /dev/cdrom /mnt/cdrom

This command mounts the file system on the disk in the CD-ROM drive to the /mnt/cdrom directory (/dev/cdrom simply refers to the actual CD-ROM device). After the file system is mounted, you can access the CD-ROM through /mnt/cdrom.

When you're finished with the file system, you should unmount it. To do so, use the umount command, as follows:

# umount /mnt/cdrom

Linux also understands FAT and FAT32 file systems and supports NTFS, but the NTFS support isn't reliable. However, unreliable NTFS support isn't a big problem because most production servers aren't dual-boot and thus don't share NTFS file systems.

In Windows, you can map a remote Server Message Block/Common Internet File System (SMB/CIFS) file system to a local drive letter by running the command

C:\ net use x: \\fileserver\files

In Linux, you can mount an NFS file system similarly, by running the mount command:

# mount fileserver:/files /mnt/files

Most modern Linux distributions also let you easily mount an SMB/CIFS file system, which you do by running the command

# mount -t smbfs //fileserver/files
/mnt/files

(The command wraps to two lines here because of space constraints.) This command mounts the SMB file-system type (-t smbfs) from the Windows server and the //fileserver/files share (which in Windows would be \\fileserver\files) on the local mount point /mnt/files.

You can automate much of the mount process, including having the system automatically mount a set of file systems at system startup. The /etc/fstab file contains information about devices, mount points, file-system types, and how to check for errors. By populating this file with the appropriate information, you can have the system do most file system mounts for you.

An entry in /etc/fstab looks similar to that in Figure 1. This entry specifies that /dev/cdrom should be mounted on /mnt/cdrom, Linux should determine the file system being used (auto), and the file system should be mounted as read-only (ro). The final two entries (0 and 2) are related to the dump system command and aren't important here—in general, just use the setting that Figure 1 shows.

You can now mount and unmount the CD-ROM by specifying only the directory, like this:

# mount /mnt/cdrom
# umount /mnt/cdrom

Linux will now mount the CD-ROM when the system boots. As you add new disks to your Linux system, you'll first format them by running the command

mkfs.ext3

(which is similar to the DOS Format command), then place the device entry in /etc/fstab so that the file system is available when the system boots.

Repairing File Systems
Linux file systems can be damaged just as Windows file systems can (e.g., during a power failure). Newer file systems, such as ext3 and ReiserFS, have journaling capabilities. This means that they behave like NTFS when they aren't properly unmounted before the system is rebooted: Instead of requiring a long file system−check when the system boots up, the newer Linux file systems quickly correct themselves. Although journaling ensures file system integrity, it offers no guarantee that you won't lose user data if the server suddenly loses power.

Sometimes you might want to force a file system check. In Windows, you can use the Scandisk or Chkdsk command to do this; in Linux, you must use the fsck (file system check) command, like this:

# fsck -c /dev/hda2

The sample command runs a file system check on /dev/hda2. Generally, you don't want to run fsck on a mounted, writeable file system. You should either unmount the file system, then run fsck, or mount the file
system as read-only instead of writeable. If the file system in question is the boot volume (e.g., /dev/hda1 in an IDE-based system), you should run the fsck command on the file system only when the Linux system is in single-user mode. You can determine whether the system is in single-user mode (called runlevel in Linux) by running the command

# telinit 1
   Previous  1  [2]  3  Next 


Reader Comments
Great article! But as a Linux enthusiast, I have to take offense at the comment that RPMs are “the closest thing to a true package stand” in the Linux world. You didn’t even mention Debian’s apt or Gentoo’s emerge. Both of these systems have revolutionized the way Linux users get software. You simply type in the package name and the software takes care of downloading and installing not only the package you requested, but any dependencies packages as well. Try that with Red Hat OR Windows. Think of it like an Add/Remove Programs with every piece of software in the world on the available list. And both these distros seem to have every package I want available, so who cares about a standard. If you do though, Debian’s Alien package will convert .rpm’s to .deb’s.

Anonymous User October 29, 2004


Thanks for the compliment.

You are correct that RPM is not the only standard, but it is indeed the most used standard. As far as ease-of-use, RPM does fall short of other methods used by Debian or Gentoo's Portage (or, indeed, of BSD's ports). With the right add-on tools RPM can emulate the same functionality.

As far as caring about standards, well, a lot of people do. :)

- Dustin


dpuryear November 01, 2004 (Article Rating: )


Great article. I'm learning more about the LINUX command line interface these days because of the RedHat 7.2 Service Console for VMware ESX Server that is hosting my Windows Virtual Machines.

I like the comparisson of the Windows tools to the equivalent Linux tools. I look forward to more articles like this although I know this isn't a LINUX IT PRO Magazine. ;)

Thanks again...

GWM November 11, 2004 (Article Rating: )


You must log on before posting a comment.

If you don't have a username & password, please register now.




Interact! Interoperability Zone Forum

Learning Path Give Linux desktops access to Microsoft Exchange Server:
"“Providing Exchange Server Access to Linux Desktop Computers”"


Learn about advanced Linux systems management techniques:
"Best Practices for Managing Linux and UNIX Servers (eBook)"


Learn about Windows Services for UNIX (SFU) and Network Information Service (NIS)
"“Microsoft Windows NT Services for UNIX”"


Use one ID to access Windows and Linux systems:
"“Centralized Authentication for Windows & Linux”"


Online Linux Help sites
"Alphabetical Directory of Linux Commands"


Top Viewed ArticlesView all articles
The Memory-Optimization Hoax

Don't believe the hype. At best, RAM optimizers have no effect. At worst, they seriously degrade performance. ...

Q. How can I use the command line to obtain a list of all the applications installed on my computer?

...

Windows SBS, EBS 2008 Hit RC1, Home Server PP1 Ships

Find out how to download the RC1 versions of Windows SBS 2008 and EBS 2008, and discover what's new in the PP1 update to Windows Home Server. ...


Windows OSs Whitepapers Replay for Exchange: Enterprise Protection and an Affordable Price

Are You Satisfied?

A Preliminary Look at Deployment Plans for Microsoft Windows Vista

Related Events Check out our list of Free Email Newsletters!

Windows OSs eBooks Understanding and Leveraging Code Signing Technologies

A Guide to Windows Certification and Public Keys

SQL Server Administration for Oracle DBAs

Related Windows OSs Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


ADS BY GOOGLE SPONSORED LINKS FEATURED LINKS

Shortcut Guide to SQL Server Infrastructure Optimization
With right tools and techniques, you can have a top-performing SQL Server infrastructure without having to cram your data centers so that they're overflowing. Download this eBook to learn how.

WinConnections Conference Fall 2008
Don’t miss the premier event for Microsoft IT Professionals in Las Vegas, November 10-13. Register and book your room by August 25 and receive a FREE room night (based on a three night minimum stay).

Become a fan of Windows IT Pro on Facebook!
Join us on Facebook and be a fan of Windows IT Pro!

Continuous Data Protection and Recovery for Exchange
Read this white paper to learn about Continuous Data Protection (CDP), Exchange 2007's local continuous replication and cluster continuous replication features.

Rev Up Your IT Know-How with Our Recharged Magazine!
The improved Windows IT Pro provides trusted IT content with an enhanced new look and functionality! Get comprehensive coverage of industry topics, expert advice, and real-world solutions—PLUS access to over 10,000 articles online. Order today!

Tips to Managing Messaging
Discover three fundamental mail and messaging management services - security, availability and control services - and how you can implement them in a Microsoft-centric mail and messaging environment.

Get It All with Windows IT Pro VIP
Stock your IT toolbox with every solution ever printed in Windows IT Pro and SQL Server Magazine plus bonus Web-exclusive content on hot topics. Subscribe to receive the VIP CD and a subscription to your choice of Windows IT Pro or SQL Server Magazine!



Solving PST Management Problems
In this white paper, read about the top PST issues and how to administer local/network PST files.

Bandwidth Monitoring Tool from SolarWinds
Identify largest bandwidth users in seconds. Get the free download now.

Transform Your Data Center at Brocade Conference 2008
Storage networking industry’s premier event at the MGM Grand, Las Vegas, September 22 - 24, 2008

Are You Litigation Ready?
Collecting and processing electronic data for e-discovery can be time-consuming and expose a business to significant legal risks. Get prepared with this free white paper

Order Your Fundamentals CD Today!
Gain an introduction to Exchange, learn server security requirements, and understand how unified communications can play a role in your messaging strategies with this free Exchange CD.

KVM over IP Solutions
Learn about a KVM over IP solution that is specifically designed to meet the needs of the distributed IT environment.
Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound
IT Library Technical Resources Directory Connected Home Windows Excavator SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing