Unix Networking Commands CS465. Network-Related Utilities talk ftp telnet rlogin, rsh, and rcp ping...

29
Unix Networking Commands CS465
  • date post

    19-Dec-2015
  • Category

    Documents

  • view

    228
  • download

    2

Transcript of Unix Networking Commands CS465. Network-Related Utilities talk ftp telnet rlogin, rsh, and rcp ping...

Unix Networking Commands

CS465

Network-Related Utilities

• talk

• ftp

• telnet

• rlogin, rsh, and rcp

• ping

• netstat

talk

• Allows two users to have an interactive conversation.

• Initiating talk with a user on your own system:

$ talk smith123

• Initiating talk with a user on a remote system (specify both the system name and the username):

$ talk [email protected]

telnet

• Lets you log on to a remote Unix system

• telnet is a "clear text" protocol. Therefore, if you log in to a personal account via telnet, your password is sent over the net, and could be read by anyone.

ssh

• Secure login to a remote Unix system

• Provides secure encrypted communications between two untrusted hosts over an insecure network.

ftp

• Set of Unix-like commands to connect and login to a remote host, navigate and list directories, and transfer files

• Most often used to (download) files from other computers over the network, or send (upload) files from your computer to another computer.

ftp session

$ ftp remote.sysConnected to remote.sysremote.sys FTP server (Version 4.9 Thu Mar 8 08:32:01 MST)Name (remote.sys): jmsmith331 Password required for jmsmith.Password:230 User jmsmith logged in.ftp> dir200 PORT command successful.150 Opening data connection for /bin/ls.total 1464drwxr-sr-x 3 jmsmith staff 1024 Jan 11 20:04 maildrwxr-sr-x 2 jmsmith staff 1536 Feb 3 18:07 junk-rw-r--r-- 1 jmsmith staff 9671 Mar 15 10:57 data226 Transfer complete.ftp> cd junk250 CWD command successful.ftp>

ftp session (continued)

ftp> dir200 PORT command successful.150 Opening data connection for /bin/ls.total 7320-rw-r--r-- 1 jsmith staff 1630 Nov 8 2000 old.c-rw-r----- 1 jsmith staff 4340 Dec 17 2000 test-rwxr-xr-x 1 jsmith staff 5574 Feb 15 11:52 new226 Transfer complete.ftp> get new200 PORT command successful.150 Opening data connection for new (5574 bytes).226 Transfer complete.5574 bytes received in 0.496 seconds (5.5 Kbytes/s)ftp> quit221 Goodbye.$

rhosts utilities

• rlogin (remote login), rsh (remote shell) and rcp (remote copy) are three utilities which allow you to perform tasks on remote systems without requiring the usual login authentication.

• All three utilities depend upon an .rhosts file, located in your home directory. The .rhosts file contains the names of your "trusted" hosts and your userid on each of those hosts.

Sample .rhosts file

$ cat .rhosts

granite.cu.edu jmsmith

remote.sys jmsmith

zeus.mit.edu rkjones

anon.ftp.com wsblack

$

Sample rsh session

$ rsh remote.sys

$ rsh remote.sys pwd

/usr/jmsmith

$ rsh remote.sys ls

mail new test

zoo

$ rsh remote.sys rm test

$ rsh remote.sys ls

mail new zoo

$ rsh remote.sys exit

$

Sample rcp command

$ rcp myfile remote.sys:/usr/jmsmith/mycopy

$

Copies myfile, located in my current directory on my local system, to the remote.sys system. It places the copy into the /usr/jmsmith directory and names the file mycopy.

Secure Logins

For secure logins, use:

ssh instead of rsh or rlogin

scp instead of rcp

pingping - Sends an ICMP echo message to another system.

Tells you if the system is up, and if your TCP/IP network services are operating correctly.

Example:

$ ping regis.edu

PING regis.edu (216.150.218.106) 56(84) bytes of data.

64 bytes from 216.150.218.106: icmp_seq=1 ttl=118 time=7.30 ms

64 bytes from 216.150.218.106: icmp_seq=2 ttl=118 time=6.60 ms

64 bytes from 216.150.218.106: icmp_seq=3 ttl=118 time=6.84 ms

--- regis.edu ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 1999ms

rtt min/avg/max/mdev = 6.607/6.920/7.308/0.306 ms

Important Net Files

• /etc/hosts - ip address/DNS names

• /etc/networks - network ip address /local names

• /etc/protocols - protocol names to protocol numbers (protocol constants)

• /etc/services - tcp/udp service names to port numbers (port assignments)

netstat

• netstat - displays  network  connections, routing tables, and interface statistics

• Options:-a network connections

-r routing tables

-i interface statistics

Unix GUIs

• A graphical user interface is just another layer of software around the kernel and shell– Requires extra disk space and memory to run

• The heart of almost all UNIX GUIs is the X window system, which is:– A general purpose window development and delivery system

– Grew out of software projects done at MIT in the 1980’s

– The basic tools (functions/procedures) exist in the xlib library

– Toolkits help developers use these to create “windows”• Examples: Motif (covered in your text) and Open Look

Using xterm (X terminal)

• Provides a window in which a user can run a Shell session – you can type shell commands in the window and the shell responds just as if no GUI existed.

• You can have numerous shell session windows active at one time and switch between them whenever needed.

• Uses a client-server model for displaying graphics. Your display is considered the server when X is running on your display. The programs that place graphical objects on the display are clients of this server.

What is a Unix Guru?

People who come into contact with the Unix system are often told: "If you have trouble, see so-and-so, he's a guru." Often, they are baffled and do not pursue the matter further.

Here is a draft of the "Unix HIERARCHY".

Hopefully all of you are at least comfortable with "user title" by now!

Unix Beginner

• Insecure with the concept of a terminal.

• Has yet to learn the basics of vi

• Has not figured out how to list a directory.

• Still has trouble with typing each line of input.

Unix Novice

• Knows that ls will produce a directory.

• Uses the vi editor, but calls it "vye".

• Has heard of C, but never used it .

• Has had his first bad experience with the rm command

• Is wondering how to read his mail

• Is wondering why the person next to him seems to like Unix so very much.

Unix User

• Is comfortable using vi.

• Has heard of regular-expressions, but isn't exactly sure what they are.

• Uses egrep to search for fixed strings.

• Has figured out that '-' precedes options.

• Thinks that gdb is a brand of stereo component.

• Knows how to read his mail and is wondering how to read the 'news' .

Unix Semi-Knowledgeable User

• Thinks that fgrep is "fast grep".

• Has figured out that mv will move directories

• Has written some C programs.

• Once used sed to do some text substitution.

• Has seen awk used, but does not use it himself.

Unix Expert

• Uses sed whenever necessary

• Uses macro's in vi, and uses ex commands when necessary

• Posts news at every possible opportunity

• Writes time-saving shell scripts

• Writes C programs using vi and compiles with cc

• Has figured out what '&&' and '||' are for

Unix Hacker• Uses sed and awk with comfort.

• Uses undocumented features of vi

• Writes C code with cat >

• Uses adb (assembly debugger) because he doesn't trust source debuggers.

• Can answer any questions about the user environment.

• Writes complicated scripts for the Bourne, Korn and C shells.

Unix Guru• Uses m4 (macro processor) and lex (lexical analyzer) with

comfort

• Writes assembly code with cat >

• Uses adb on the kernel while system is loaded

• Customizes utilities by patching the source.

• Reads device driver source with his breakfast .

• Uses make for anything that requires two or more distinct commands to achieve.

• Has learned how to breach security, but no longer needs to try.

Unix Wizard

• Writes device drivers with cat >

• Fixes bugs by patching the binaries.

• Can answer any question before you ask.

• Writes his own troff macro packages.

• Is on a first-name basis with Dennis, Bill, and Ken.

What does CS468 cover?

• In CS468 you will learn to– Perform UNIX system administrator tasks. – Install and configure a UNIX system. – Manage UNIX users, file systems and devices using

root powers. – Access UNIX file management and process

management functions via system calls. – Configure a UNIX system for networking. – Use UNIX security mechanisms to protect a UNIX

system.