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

File System Permissions
Linux is file-centric, which means that most of what Linux offers to applications and users is done through a set of files. Security in Linux is also file-centric and is based almost entirely on the permissions placed on a file or directory. NTFS in Windows offers an advanced permission facility that's based on ACLs. In theory, Linux also supports ACLs, but often this support isn't enabled or even compiled into the Linux kernel. Because Linux's ACL support is inconsistent, I instead concentrate on the more traditional Linux permission model.

Linux provides three types of permissions that you can apply to a file: read, write, and execute (r, w, and x). In addition, you can set permissions for three types of users: owner, group, and world (u, g, and o). Owner is just that, the file's owner; group is the "group owner;" and world is the set of users that aren't the owner or in the group. World is basically a catch-all, similar to Everyone in Windows.

As I mentioned earlier, you use the chgrp and chmod commands to set group permissions. For example, to restrict control of the /files/students directory to only the users in the students group, you'd run the commands

# chgrp -R students /files/students
# chmod -R u=rwx,g=rwx /files/students

The −R option specifies that chgrp and chmod should recursively apply the changes, and the u=rwx,g=rwx field translates to "the owner will have read, write, and execute permissions, and the group will also have read, write, and execute permissions."

To let only a file's owner access the file, you'd run chmod as follows:

# chmod u=rwx /user/file

In Windows, the equivalent command is Cacls:

C:\ cacls c:\user\file /e /p bob:f

/e specifies that the Cacls command will edit an ACL instead of replacing it, and /p bob:f grants Bob full permissions to c:\user\file.

To let both the owner and anyone in the group access the file, you'd enter

# chmod u=rwx,g=rwx /user/file

Again, remember that in Linux you can assign permissions only to one group, whereas with NTFS you can specify rights to multiple groups by using ACLs. (Some file systems in Linux support ACLs; they just aren't used by default.) You can find more information about chmod and chgrp by reading the commands' man pages. (For more information about man pages, see "Linux's Online Help.")

Networking
Networking is an integral part of Linux—so much so that, as in Windows, it's virtually impossible to remove the networking components without breaking the OS (but not nearly as difficult to remove the Web browser!). In Windows, when you want to manage networking, you must define and configure NICs by running the Network Connections Control Panel applet. You can also automate the process of configuring networking in Windows by using the Netsh command. Like Windows, Linux provides command-line and GUI tools to manage networking.

Let's walk through configuring a Linux system for networking. First, you must determine whether Linux knows about your NIC. The easiest method to accomplish this is to run the ifconfig command, which tells you whether the OS is providing access to the NIC:

# ifconfig eth0

The eth0 device is simply the first NIC that Linux sees. In Windows, this device is called "Local Area Connection" when you view it in the Network Configuration applet or via the Windows Ipconfig command. (The closest Windows equivalent of ifconfig is ipconfig /all.) After you run ifconfig, you'll see output on screen similar to that in Figure 2. Now that you know that the NIC is working, you can configure it—again by running ifconfig:

# ifconfig eth0 192.168.1.10
netmask 255.255.255.0

(The command wraps to two lines here because of space constraints.) Running this command displays the eth0 interface (i.e., the first NIC on the system), which has the IP address 192.168.1.10 and a subnet mask of 255.255.255.0. Linux also automatically adds a network route to the routing table, so that you can now ping other hosts on the LAN, by running the command

# ping -c 1 192.168.1.1

The −c option specifies that the Ping command pings the remote server only once. The command then displays the output that Figure 3 shows (several lines in Figure 3 wrap because of space constraints). In Red Hat, you can automate the network configuration process I've just described—and ensure that the configuration is maintained after a reboot—simply by running the command

# netconfig

If you want to connect the system to the Internet, you must perform two more steps: Configure a default router, and configure your DNS servers. To configure the default router, use the route command (which is similar to the Windows route command):

# route add -net default
gw 192.168.1.1

This command—which wraps to two lines here—specifies that we're adding a route to a network (rather than just to a host), that the network is "default" (the value that's used when specifying a default router), and that the default router (gw) is 192.168.1.1.

Finally, you add your DNS servers to the /etc/resolv.conf file, which configures the server's DNS resolver, by using the following syntax:

nameserver dns1.example.com
nameserver dns2.example.com

As I mentioned, instead of performing the network configuration manually, you can automate this process by running the netconfig command. Netconfig lets you set up your networking to use either DHCP or a static IP address. It works the same as the Windows Add Network wizard. Although simply using netconfig is far easier than the process I just described, by learning exactly what netconfig is doing you have a better understanding of how Linux networking works. You'll probably find it helpful to investigate other Linux commands that are also available in Windows, such as netstat and nslookup.

Installing and Managing Software
Software management in Linux can often be at least as difficult as it is for Windows users. In Linux, software is distributed in various ways. Most distributions, such as Red Hat with Red Hat Package Manager (RPM), have their own package format. RPM packages are well supported across most Linux distributions and are the closest thing to a true package standard in the Linux world.

An actual RPM file is a single file archive that contains all the software and installation scripts needed to install an application, much like setup.exe or an .msi file in Windows. To install an RPM, you run the rpm command along with the RPM file as an argument:

# rpm -i program.rpm

The −i specifies that you want to install program.rpm. To remove the program you just installed from the Linux system, run the rpm command and specify the −e (extract) option with the program name:

# rpm -e program

To determine whether a program is installed, run the rpm command and specify the −q (query) option with the program name:

# rpm -q program

This procedure should feel similar to using the Windows Add or Remove Programs applet. Most Linux systems, such as RHES, provide a GUI front end for RPM, so the similarity is even closer.

Linux differs from Windows in that many distributed Linux applications don't use a standardized packaging format. Typically, these types of applications are distributed in source-code form, and you must compile and install them yourself. Fortunately, most applications that are installed from source code follow the same basic steps in their installation:

  1. Extract the files from the archive by running the tar command (the tar command copies files to or restores files from an archive):
    # tar xfz program.tgz
  2. Change the current directory to the directory just created when tar extracted files from program.tgz:
    # cd program/
  3. Compile the application by running the following commands:
    # ./configure
    # make
    # make install

At this point, you're finished installing the application. Because this application didn't use a package manager such as RPM, it might be difficult to remove the application. Typically, you'd first try to run the command

make uninstall

but this method fails more often than not. The only other option would be to manually delete the installed files or to use software that manages applications that are installed from source code.

Go Forth into Linux
Linux and Windows system administrators perform the same sorts of tasks: They manage users, install and remove software, troubleshoot bad network connections, and of course, try to take a break now and then. When you find yourself called on to manage a Linux system in your Windows environment, you'll have some familiarity with essential commands and procedures that you can use to get up to speed in Linux system administration.

End of Article

   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
Friday at PASS Europe 2006

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

VMware and the Future of Virtualization

What's next for virtualization and business IT? Windows IT Pro senior editor Jeff James speaks with VMware President and CEO Diane Greene on the future of virtualization technology. ...

The Memory-Optimization Hoax

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


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

IT Connections
Dive into the new Microsoft platforms and products you implement and support with the experts from Microsoft, TechNet Magazine, Windows ITPro and industry gurus. There are 70+ sessions and interactive panels with networking opportunities.

Attention User Group Leaders...
Announcing the eNews Generator—a FREE HTML e-newsletter builder for user group leaders. Build your HTML and text e-newsletters in minutes and add Windows IT Pro & SQL Server Mag articles alongside your own message!.

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!

Get SQL Server 2008 at WinConnections
Don’t miss Microsoft Exchange and Windows Connections conferences, the premier events for Microsoft IT Professionals in Las Vegas, November 10-13. Every attendee will receive a copy of SQL Server 2008 Standard Edition with one CAL.



Interested in Email Encryption?
Read about the advantages of identity-based encryption in this free report.

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.

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