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
Accessing Database Data with ADO

...

The Memory-Optimization Hoax

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

Friday at PASS Europe 2006

Kevin talks about the closing day of the event and shares a funny Microsoft film. ...


Windows OSs Whitepapers Why SaaS is the Right Solution for Log Management

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.

Job Openings in IT


ADS BY GOOGLE SPONSORED LINKS FEATURED LINKS

Maximize your SharePoint Investment – 8 Cities
Discover best practices and tips for both architecting and administering SharePoint. Early Bird Price of $99 through Sept 15th.

Find a new job now on the all new IT Job Hound!
Search jobs, post your resume, and set up job e-mail alerts!

Master SharePoint with 3 eLearning Seminars
Learn how to build a better SharePoint infrastructure and enable powerful collaboration with MVPs Dan Holme and Michael Noel. Register today!

Top Tools for Virtualization Disaster Recovery & Replication
View this web seminar on August 14th to learn about two tools that will result in faster backup and restore with P2V disaster recovery.

SharePointConnections 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).

VMworld 2008 - Sign Up Today!
Join your peers on September 15-18 at The Venetian Hotel in Las Vegas as VMware hosts VMworld 2008, the leading Virtualization event.



Increase Application Performance
Free White Paper by Editor's Best winner, Texas Memory Systems.

Microsoft® Tech•Ed EMEA 2008 IT Professionals
Advance your thinking with new ideas and practical real-world solutions at Microsoft’s FIVE day technical infrastructure conference 3-7 Nov., 2008. Register before 26 September 2008 to save €300.

Order Your SQL Fundamentals CD Today!
Learn how to use SQL Server, understand Office integration techniques and dive into the essentials of SQL Express and Visual Basic with this free SQL Fundamentals CD.

Are You Really Compliant with Software Regulations?
View this web seminar that will help you with compliance best practices and check out a management solution to assure that you won’t be in jeopardy of an audit.

Virtualization Congress Oct. 14-16 in London
Don't miss Virtualization Congress, the premiere EMEA conference dedicated to hardware, OS and application virtualization. Oct. 14-16.
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 ITTV
IT Library Technical Resources Directory Connected Home Windows Excavator Windows 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