Lunux who command who is logged in

an article added by: Daniel K. at 11282007



In: Categories » Computers and technology » Linux Commands » Lunux who command who is logged in

On systems that allow users to log in to other users’ machines or special servers, you will want to know who is logged in. You can generate such a report by using the who command:

    [michael@workbox michael]$ who
  

The who report looks like this:

    michael tty1 Jun 14 18:22
    rwhite pts/9 Jun 14 18:29 (:0)
    root pts/11 Jun 14 21:12 (:0)
    root pts/12 Jun 14 23:38 (:0)

A Variation on who: w

The w command displays the same information that who does and a whole lot more. The details of the report include who is logged in, what their terminal is, where they are logged in from, how long they’ve been logged in, how long they’ve been idle, and their CPU utilization. The top of the report also gives you the same output as the uptime command.

Networking Tools

If you are starting your experience with Linux in an already networked environment, you may find some of these tools handy for getting around.

CAUTION

These networking tools are useful, but allowing telnet, rsh, remote X, and ftp connections to a server can be risky from a security standpoint. See Linux tutorial 9 for more information on securing a Linux server.

telnet

As was mentioned in earlier modules, Linux understands the concept of multiple users logged in to the same workstation at the same time. So in order to allow for someone to log in to another host from remote, the telnet command was created. The format of the command is as follows:

    [rwhite@workbox rwhite]$ telnet gregory

where gregory is the name of another computer running either Linux or a variant of UNIX. Once you run the command, you will get a login prompt from that machine. Logging in to that machine enables you to run programs on the other host just as if you were running them on your own. If you aren’t sure where you are logged in, use the uname command (discussed earlier) to find out where you are. Due to security concerns, telnet has fallen out of favor as a method for logging in to remote machines (see Linux tutorial 15 for a better alternative). However, because of its ability to send and receive ASCII text over a network port, telnet is still very useful as a diagnostic tool. You’ll see some examples of this in later modules.

Remote Shell: rsh

As you’ve seen with telnet, you must enter a username and password in order to log in to another host. For many people who found the need to log in to other hosts often, this became a nuisance. They wanted the other host to automatically trust them so that when issued a remote login request, the system would allow them access without asking for a login and password. The double-win with a feature like that is the ability to automate tasks that require one host to invoke a program on another host. To accommodate this, the rsh command was created. In its simplest form, specify the name of the host you wish to log in to the way you would for telnet. For example:

    [rwhite@workbox rwhite]$ rsh gregory

If you set up your configuration files so that gregory knows to trust you, the system will automatically give you a shell prompt. If the configuration file does not automatically trust you, you will need to enter your password again. To set up the configuration file, edit the .rhosts file (yes, there is a period in front of the filename) in your home directory. When there, create a line that looks like this:

    host_to_trust your_username

If you want to be able to rsh from workbox to gregory without being prompted for a password, you would create the following file in an .rhosts file in your home directory on gregory: workbox rwhite And you’d be ready to go! Once again, rsh is covered here for completeness, but before you decide to use it for anything serious, I recommend that you explore ssh in Linux tutorial 15.

legal notice

Our website is not responsible for the information contained by this article. Web-articles is a free articles resource.
Suggestion: If you need fresh, daily updated content for your website, feel free to use our service. Click here for more information.

Useful tools and features

Lunux who command who is logged in  
If you like this article (tutorial), please link to it from your web page using the information above.

related articles

1. Linux is built upon the foundation of file systems
File Systems Linux is built upon the foundation of file systems. They are the mechanisms by which the disk gets organized, providing all of the abstraction layers above sectors and cylinders. In this module, you’ll learn about the composition and management of these abstraction layers supported by the default Linux file system, ext2, and its more robust counterpart, ext3. This module covers the many aspects of managing disks. This includes creating partitions, establishing file systems, automating the process ...

2. Mounting and Unmounting Local Disks
Linux’s strong points include its flexibility and the way it lends itself to seamless management of file locations. Partitions are mounted so that they appear as just another subdirectory. Even a substantial number of file systems look, to the user, like one large directory tree. This characteristic is especially helpful to the administrator, who can relocate partitions to various servers but can have the partitions still mounted to the same location in the directory tree; users of the file system need not know abou...

3. The fsck tool short for File System ChecK
Using fsck The fsck tool, short for File System ChecK, is used to diagnose and repair file systems that may have become damaged in the course of daily operations. Such repairs are usually necessary after a system crash in which the system did not get a chance to fully flush all of its internal buffers to disk. (Although this tool’s name bears a striking resemblance to one of the expressions often uttered after a system crash, that this tool is part of the recovery process is strictly coincidence.) Us...

4. The process of adding a disk under Linux on the Intel
Adding and Partitioning a Disk The process of adding a disk under Linux on the Intel (x86) platform is relatively easy. Assuming you are adding a disk that is of similar type to your existing disks (e.g., adding an IDE disk to a system that already has IDE drives or adding a SCSI disk to a system that already has SCSI drives), the system should automatically detect the new disk at boot time, and all that is left is partitioning it and creating a file system on it. If you are adding a new type of disk (...

5. With the partitions created you need to put file systems on them
Syncing disks. WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. [root@tedford /root]# If you needed to write an /etc/fstab file yourself for this configuration, it would look something like this: /dev/hdb1 / ext3 defaults 1 1 /dev/hdb2 swap swap defaults 0 0 /dev/hdb3 /usr ext3 defaults 1 2 /dev/hdb5 /home ext3 defaults 1 2 /dev/hdb6 /var ext3 defaults 1 2 /dev/hdb...

6. Mounting NFS partitions works much the same way as mounting local partitions
Mounting NFS Partitions Mounting NFS partitions works much the same way as mounting local partitions. The only difference is in how the partition is addressed. On local disks, partitions are addressed by their device name, such as /dev/hda1. In NFS mounts, partitions are referenced by their hostnames and export directories. Thus, if the server named ungerer is allowing your host to mount the directory /export/SL1200/MK2 and you want to mount this to /projects/topsecret1, you would use this command:...

7. Using autofs to mount partitions across the network
Starting the autofs Service Because the way you’re using autofs to mount partitions across the network relies on NFS, before using it you’ll need to be sure you can do normal NFS mounts. Once you have this working, just make a simple change to your startup scripts to deploy the autofs service. The easiest way to do this is to run the redhat-config-services utility to enable the daemon. Simply start the configuration tool and mark the autofs check box as shown. If you need to start autofs by hand...

8. Configuring Individual Partitions on Linux machines
Managing Quotas In any multiuser environment, you’re bound to run across users who—either refusing to play fair or because they’re oblivious to common courtesy—practice the fine art of disk hogging, taking up more than a reasonable amount of disk space. This problem can be managed in several ways. The first and most obvious solution is to beg and plead. This rarely works. The second approach is peer pressure: You regularly and publicly post the amounts of disk space being hogged by these users. If peop...