Sunday, July 20, 2014

Linux/Unix - Network Related Utilities

xhost

  • The xhost command is a server access control command for the X-window environment. The command
  •   
    
    xhost  hostname
    adds hostname to the list of clients that can connect to your machine.
  • The command xhost + would allow any host to connect to your machine. This is particularly useful if you need to log in to a remote machine to perform some task. For example, after logging into some remote host one can use the setenv command enable display on the screen of your host.
  • The command xhost - hostname removes hostname from the list of host that can connect to your machine.
  • The command xhost - disables access to all client except special "authorized" clients. These clients would be listed in your .rhosts file. 

talk

  • The talk command allows two users on the same host or on different hosts to have an interactive conversation.
  • The talk command divides the window/screen into two parts. The upper part of the screen/window is the send window while the lower part of the screen/window is the receive window. Each user is able to type into the send window while the talk command displays what the other user is typing in the receive window.
  • Using the talk command - some examples:
  •      talk  kellyk         - talk to a local user 
    
         talk  dale@wave.com  - talk to a remote user 
    
    
  • Some notes about using talk:
    • The user you wish to talk with must be logged on.
    • The "mesg" command can be used to prevent others from "talking" to you. For example: mesg n
    • Talk may be disabled on other systems for security reasons.
  • See the talk man page for details.

finger

  • The finger command displays information about users on a given host. The host can be either local or remote.
  • Example 1: Show who is logged onto the system
     finger            - show all local logins 

     finger @wave.com  - show remote system's logins 

 

     Login       Name              TTY Idle    When    Site Info

     rjw      Robert J West         p0  7:11 Sat 10:32 

     mdine    Marc Dine             p1  7:11 Wed 09:46 

     zepht    James S. Tallis       p2  7:11 Wed 09:46 

     bqs5     Barbara Baker         p3  8:42 Sat 10:33 

     davek    Dave Kiley            p4  8:42 Sat 10:33 

  • Example 2: Show information about a specific user
     finger ksmith         - look for a local user 

     finger dale@wave.com  - look for a remote user 



     Login name: dale                    In real life: Dale Smith

     Directory: /u/ibm/dale              Shell: /bin/csh

     Project: 

     Parallel Programming for the masses. (Masses of what!)

     Plan:



          Think globally, act locally: install solar panels !

  • If you create a .plan and/or .project file in your home directory and make them world readable, they will appear in the Plan and Project fields of the finger output.
  • Finger may be disabled on other systems for security reasons.
  • See the finger man page for details.

ping

  • The ping command sends an echo request to a network host. It is useful for:
    • Determining the status of the network and various foreign hosts.
    • Tracking and isolating hardware and software problems.
    • Testing, measuring, and managing networks.
  • The ping command sends one datagram per second and prints one line of output for every response received. Round-trip times and packet loss statistics are calculated and displayed.
  • Example:
  • % ping farragut
    
    PING farragut.cis.rit.edu: (164.122.27.33): 56 data bytes
    
    64 bytes from 164.122.27.33: icmp_seq=0 ttl=254 time=3 ms
    
    64 bytes from 164.122.27.33: icmp_seq=1 ttl=254 time=2 ms
    
    64 bytes from 164.122.27.33: icmp_seq=2 ttl=254 time=2 ms
    
    64 bytes from 164.122.27.33: icmp_seq=3 ttl=254 time=2 ms
    
    64 bytes from 164.122.27.33: icmp_seq=4 ttl=254 time=2 ms
    
    64 bytes from 164.122.27.33: icmp_seq=5 ttl=254 time=2 ms
    
    ^C
    
    ----farragut.cis.rit.edu PING Statistics----
    
    6 packets transmitted, 6 packets received, 0% packet loss
    
    round-trip min/avg/max = 2/2/3 ms
    
    
  • See the ping man page for details.

ftp

  • ftp stands for File Transfer Protocol. File transfer provides a means for you to obtain computer files (text, image, sound, etc.) from other computers over the network.
  • ftp can also be used to send (upload) files from your computer to another computer, providing you have write permission or a real account on the machine you are uploading.
  • The ftp utility has its own set of UNIX like commands which allow you to perform tasks such as:
    • Connect and login to a remote host
    • Navigate directories
    • List directory contents
    • Put and get files
    • Transfer files as ascii, ebcdic or binary
  • A sample ftp session appears below. The commands which are entered by the user are in bold type.
  • farragut% ftp grace.rit.edu
    
    Connected to grace.rit.edu.
    
    220 grace.rit.edu FTP server (Version 4.9 Thu Sep 2 20:35:07 CDT 1993)
    
    Name (grace.rit.edu.edu:jsmith): jsmith
    
    331 Password required for jsmith.
    
    Password:
    
    230 User jsmith logged in.
    
    ftp> dir
    
    200 PORT command successful.
    
    150 Opening data connection for /bin/ls.
    
    total 1464
    
    drwxr-sr-x   3 jsmith   staff       1024 Mar 11 20:04 Mail
    
    drwxr-sr-x   2 jsmith   staff       1536 Mar  3 18:07 Misc
    
    drwxr-sr-x   5 jsmith   staff        512 Dec  7 10:59 OldStuff
    
    drwxr-sr-x   2 jsmith   staff       1024 Mar 11 15:24 bin
    
    drwxr-sr-x   5 jsmith   staff       3072 Mar 13 16:10 mpl
    
    -rw-r--r--   1 jsmith   staff     209671 Mar 15 10:57 myfile.out
    
    drwxr-sr-x   3 jsmith   staff        512 Jan  5 13:32 public
    
    drwxr-sr-x   3 jsmith   staff        512 Feb 10 10:17 pvm3
    
    226 Transfer complete.
    
    ftp> cd mpl
    
    250 CWD command successful.
    
    ftp> dir
    
    200 PORT command successful.
    
    150 Opening data connection for /bin/ls.
    
    total 7320
    
    -rw-r--r--   1 jsmith   staff       1630 Aug  8 1994  dboard.f
    
    -rw-r-----   1 jsmith   staff       4340 Jul 17 1994  vttest.c
    
    -rwxr-xr-x   1 jsmith   staff     525574 Feb 15 11:52 wave_shift
    
    -rw-r--r--   1 jsmith   staff       1648 Aug  5 1994  wide.list
    
    -rwxr-xr-x   1 jsmith   staff       4019 Feb 14 16:26 fix.c
    
    226 Transfer complete.
    
    ftp> get wave_shift
    
    200 PORT command successful.
    
    150 Opening data connection for wave_shift (525574 bytes).
    
    226 Transfer complete.
    
    528454 bytes received in 1.296 seconds (398.1 Kbytes/s)
    
    ftp> quit
    
    221 Goodbye.
    
    
  • Many computers on the Internet permit anonymous ftp . You can login to these machines without a real account, to obtain files which have been made publicly available. Typically, the user name anonymous is used, coupled with your email address as the password.
  • Anonymous ftp is usually restricted so that users can only see what the server permits them to see. Anonymous users do not have full privileges as would a user with a real computer account.
  • See the ftp man page for details.

telnet

  • Telnet is a utility that allows a computer user at one site to make a connection, login and then conduct work on a computer at another site. For example, you can use the telnet command to run a program in your directory on a supercomputer thousands of miles away.
  • Telnet is used to access many of the Internet resources, such as databases, libraries and computers
  • Example telnet session:
  • % telnet grace
    
    Trying...
    
    Connected to grace.rit.edu.
    
    Escape character is '^]'.
    
    
    
    
    
    Digital UNIX (grace) (ttyp1)
    
    login: jsmith
    
    Password: 
    
    Last login: Wed Oct  8 01:51:36 from yorktown.cis.rit
    
    
    
    Digital UNIX V3.2D-1 (Rev. 41); Fri Oct 25 20:21:47 EDT 1996 
    
    Digital UNIX V3.2D-1 Worksystem Software (Rev. 41)
    
    
    
    Please contact the ISC HelpDesk at 475-6929 voice or 475-2810 tty,
    
    stop by our office in Ross room A291, or use ASK Information
    
    Systems and Computing for questions or concerns.
    
    
    
    ***************************************************************************
    
    
    
    You have mail.
    
    Disk quotas for user 8350 (uid 8350):
    
        Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
    
            /users     762    6400    6400              53    6400    6400      
    
       {  do some work }
    
    
    
    % logout   
    
    Connection closed by foreign host.
  • See the telnet man page for details.

rlogin

rsh

rcp

    • rlogin (remote login), rsh (remote shell) and rcp (remote copy) are three utilities which allow you to perform tasks on other machines without requiring the usual login authentication.
    • All three utilities depend upon a .rhosts located in your home directory. The .rhosts file contains the names of your "trusted" hosts and your userid on each of those hosts. An example appears below:
    •      apache.unm.edu  jsmith
      
           zeus.mit.edu    jsmith
      
           athena.com      smith
      
           fox.eeco.org    smithj
      
      
    • rlogin: Allows you to login to a remote machine. It is nearly identical to telnet in function and appearance, however if your .rhosts file is setup accordingly, you will be able to login to your account on another machine wihout having to enter a userid and password.
    • rsh: The remote shell command can be used to execute a command on remote host or log into remote host. With the proper .rhosts file, authentication is not required.
    • Examples:
    • rsh host2                       - will connect to host2 for
      
                                        login
      
      rsh host2 df                    - check the amount of free 
      
                                        disk space on remote host2
      
      rsh host2 ps aux |grep jsmith   - check for processes owned 
      
                                        by jsmith on host2
      
      rsh host2 rm /tmp/myfile.old    - remove a file in host2 
      
      rsh host2 cat test1 ">>" test2  - append test1 file on remote 
      
                                        host to test2 file on remote 
      
                                        host
      
      rsh host2 cat test1 >> test2    - append test1 file on remote 
      
                                        host to test2 file on local
      
                                        host
      
      
    • rcp: Remote copy enables you to copy files between different systems. With the proper .rhosts file, authentication is not required.
    • Example:
    •      rcp localfile host2:/home/eng/journal
      
      
    • See the following man pages for details:
      • rlogin
      • rsh
      • rcp

0 comments:

Post a Comment