Upload a File to a Machine With Telnet

Unix Lab

telnet, ftp, ssh and scp


In this module we will explore tools for connecting to other computers, downloading and uploading files.


telnet

telnet is a Unix utility that lets yous login to another computer on the Net provided yous take an account on that computer. This can be specially useful if you work part time and wish to login to the computers at schoolhouse from work after hours or during breaks. If you exercise not alive near the campus and the department dial-in telephone lines are not a local call, you might be able to use telnet if information technology is provided by an on-line service to which you lot subscribe.

Find out the proper name of another machine in your lab. Usually, the proper noun is displayed on a sticker attached to the machine itself. For example, in MH 227 the machines are named 'sunlab2-x' where x is an integer (e.g. sunlab2-fifteen).

Since you already have an account for any of the machines in your lab, yous tin can apply telnet to login to that machine past typing:

telnet machineName

When you log out of machineName you lot volition exist back on the auto from which you issued the telnet command. If the computer is non local to our network, you may have to refer to it by the name by which it is known on the Cyberspace. If you lot were using telnet from your Internet access provider connection at home, for example, blazon:

telnet machineName.cs.sjsu.edu

You should get to machineName again but this fourth dimension you used a longer name. Yous recognize the machineName part of the name. The cs office of the name denotes the organization every bit belonging to the Computer Science department. The sjsu portion identifies the section as belonging to San Jose State. The edu portion, sometimes called the root domain, indicates that San Jose State is an educational institution. And then, machineName.cs.sjsu.edu is the fully qualified domain proper name (FQDN) of our calculator machineName . Commercial sites on the Internet are often in the root domain .com, government sites are usually in the root domain .gov, and internet service providers (ISPs) in general are oft in .net. You will also find that each country has information technology's own root domain. Canada, for example, has a root domain of .ca, and Japan'south root domain is .jp.

Each computer on the Cyberspace also has a numeric address known as its IP accost. The numeric address is used past computers to locate other computers, merely it can likewise exist typed in. For instance, machineName 'due south IP address can exist plant by checking the same sticker you used to find its text proper name. It might be something like 192.168.11.10. All IP addresses have 4 numbers separated past the '.' grapheme. Each number must be between 0 and 255 although there are restrictions which we need not go into here.

Type:

telnet IP_address
(where IP_address is the 4-part number for the reckoner to which you want to login.)

Whenever you lot endeavor to contact another figurer, the IP address of that computer has to be determined. If the destination computer'southward IP number isn't already known, then a asking is made to a "proper name server" that looks upwards the proper name you lot're using to see if it can locate its IP address. There are several types of name services. On the Net, the domain name system (DNS) is the service that maps the human-friendly domain proper noun of a estimator onto it's IP address.

Sometimes you will try the proper noun of a calculator such equally zeus.cs.farawayu.edu when you utilize telnet and go the response:

zeus.cs.farawayu.edu: unknown host telnet>      

Since telnet is an application program that can accept commands, the prompt:

telnet>

tells you lot that telnet is awaiting a command, since it could non satisfy your initial request to connect to the zeus estimator in the CS section at Faraway University. At this point you lot tin type quit to leave telnet or help to see the commands that you take at your disposal.

Try using telnet to access zeus.cs.farawayu.edu. At the telnet> prompt, employ the open up command to login to machineName .


ssh

One of the drawbacks of telnet is that any information that you type is sent un-encrypted over the network. Sadly, in that location are persons who can use easily available software to snoop on network traffic and selection off text as information technology "goes past". In particular, your passwords and login name are susceptible to this kind of snooping.

Almost responsible sites utilize ssh instead of

telnet

to allow users to login from remote locations. Think of

ssh

as a secure version of

telnet

. In the lab at the command line blazon:

ssh user@cs02.cs.sjsu.edu

where

user

is the name of your Unix account for the machines in Washington Square Hall (WSQ one).

You should accept a Unix business relationship in WSQ one (this will get indispensable to you lot if you want to be able to access Unix systems from dwelling house). If you exercise not, however, y'all can upshot the command:

ssh user@machineName

This should allow you lot to login to any of the other machines in your lab.

You will be required to blazon in your password and and then you are really using the other machine to execute whatever commands that you enter. In social club to use

ssh

you must have some software which you lot can acquire for your dwelling house estimator from various sources (utilize a google search to locate these sites).

ssh

encrypts all communication between the 2 computers. This makes information technology well-nigh impossible for anyone to steal your login proper noun and password (it would have reckoner resources more often than not only bachelor to the federal government).

ssh is used just as telnet is used. The name of the computer or its IP address will identify which computer you want. Once you have accessed the arrangement y'all want, you will be presented with a login prompt as in the case of telnet.


ftp

ftp stands for file transfer protocol. A protocol is a prepare of agreements between persons or governments or (in this case, computers) governing how communications will proceed. ftp is a protocol that specifies a method for transferring files betwixt computers. It is also the proper name of a Unix utility that allows you to copy files between two computers. The 2 computers might be a reckoner far away on the Internet and the computer to which y'all are currently logged on or information technology might be the calculator at schoolhouse and your personal computer at dwelling.

ftp (the utility) requires that you accept an account on each auto. Some computer sites have special accounts just for accessing their files past persons from other sites. The login name for the business relationship is anonymous and your e-mail address is usually used as a password.

Let'south assume you wish to copy a file with frequently asked questions nigh the comp.lang.c newsgroup. This is a newsgroup where persons can share data or questions about the C language. We will use the ftp utility to re-create this file from its location at mirrors.aol.com.

Type:

ftp mirrors.aol.com

ftp will (hopefully) locate the site and connect you to it. Information technology volition then ask you for your login name. Since this is a site that supports anonymous ftp admission, at the prompt blazon:

anonymous

Yous volition so be asked to supply your e-mail address for a password. For instance (you lot will make the advisable modifications):

babuddy2@educatee.cs.sjsu.edu

ftp access is not the same as a telnet access. There are only a few commands that you lot can issue. You lot can navigate among the directories to which you have access past using the cd control.

You tin inquire to see a listing by using the dir control. In this case, the file we are looking for will be found in the directory /pub/rtfm/usenet/comp.lang.c. Consequently, at the ftp> prompt type:

cd /pub/rtfm/usenet/comp.lang.c

Ask to see a listing to see the files that are in this directory. The file we are looking for is chosen C-FAQ-listing. In society to re-create the file from the remote site to the directory we are in on our own estimator, we use the ftp command: get. If nosotros wanted to copy a file from our calculator to some other one, we would use the ftp command: put.

Since we desire to receive a re-create from the remote site type (at the ftp> prompt):

get C-FAQ-list

Once you have received the file, ftp displays some statistics about the file transfer. If you desire to re-create more files, you just repeat the procedure to a higher place. Once you lot are done, just type quit at the ftp> prompt.

If the file you are transferring is not a text file (for example, it might a graphical prototype file), then at the ftp> prompt, earlier you re-create the file, type the control: binary.

Here is a list of some of the ftp commands you can employ:

  • dir
    View the files and directories in the current directory as in the long listing form obtained with ls -l ( see the ls command).

  • cd directory
    Change to (enter) the named directory.

  • pwd
    Show the proper noun of the electric current directory.

  • get file1 file2
    Recollect file1 and name it file2 on the system from which you initiated ftp.

  • put file1 file2
    Send file1 from the system on which you initiated ftp and name it file2 on the remote organization.

  • mget *.txt
    Transfer all files in this directory ending with ".txt"; prompt before transferring each file.

  • quit
    Quit the ftp utility. Yous will be back at the control line level in Unix.


The scp control

In this section, we will be looking at the trouble of moving files between networked computers. We have already seen how to exercise this with ftp. Not all systems are set up to support ftp. Part of the problem is that, like telnet, the communication between the two computers is un-encrypted and people can snoop the network traffic to capture passwords.

There is an encrypted form of the cp command. This control allows you to copy files from i figurer to another (not merely from i folder to some other on a unmarried computer). The command is the scp command.

scp stands for "secure copy" and information technology allows united states to movement files betwixt computers on a network. For students in this course, that usually means being able to transfer files between Unix machines in 2 split sites (e.thousand. betwixt machines in Duncan Hall and machines in Washington Foursquare Hall).

Suppose you take a Unix account in WSQ with the login proper noun of zx5555. Suppose you lot likewise have a Unix business relationship in DH or MH with the login proper name of a2345. How can you transfer files from one computer to another?

The first thing to remember is that non all transfers are possible. For example, if yous want to move files betwixt an business relationship in DH 450 and WSQ, y'all accept to be very aware of the fact that DH 450 is behind a firewall that doesn't permit you lot to directly login to those machines from outside that lab.

If you are IN the DH 450 lab, then y'all tin can Push button files from DH 450 to WSQ computers or you tin PULL files from WSQ computers into DH 450. If you are outside of DH 450 you cannot do either with respect to moving files into or out of DH 450. Please re-read this previous sentence until you are sure you lot understand it.

From the lab (e.yard. DH 450) use the ssh control to login to your WSQ account. Once you have logged into your account, create a directory at that place with the name "transfer" using the mkdir command.

In a separate terminal window locate a file that you desire to push from your DH account to your WSQ business relationship (let's say that file is called myProg.java).

Now type in the following (from the directory containing myProg.java):
scp myProg.coffee zx5555@cs05.cs.sjsu.edu:transfer

At present in the first window look in the transfer directory to make sure your file has been copied from your DH account to your WSQ account.

You lot tin can copy in the other direction too: from your WSQ business relationship to your DH account.

From the lab (due east.g. DH 450) use the ssh command to login to your WSQ business relationship (or if you lot already have a window open up to that account go on with the next phase). Nosotros volition presume that (equally in the previous practice) y'all now have a directory names "transfer" on you WSQ account. Place a file in your "transfer" directory in your WSQ account that you want to copy to your DH account. (Allow's just assume the file is called classNotes.txt)

Although not strictly necessary, if we create a folder on our DH account by the name of "transfer" as well, then we can have a identify on both accounts which we use to transfer files. So, if you lot don't already accept one, create a directory named "transfer" in your home directory.

Now blazon in the following (from your home directory):
scp zx5555@cs05.cs.sjsu.edu:transfer/classNotes.txt transfer

The scp command will prompt you for you countersign on the WSQ account and then proceed to copy the file classNotes.txt in your transfer folder into the transfer folder in your DH business relationship.

Experiment to see if you lot can copy the file classNotes.txt from the WSQ account and give information technology a new name (e.g. notes) in the transfer folder in your DH account.

Use the man control to come across how you would copy an unabridged folder of files and folders with the scp command. The option yous desire to examine is the -r option.


Click on to go back to the main directory.

Click on to take the quiz for this module.

These pages were developed by John Avila SJSU CS Dept.

morsecaphy1940.blogspot.com

Source: http://www.cs.sjsu.edu/web_mater/cs46b/cs46blab/telnetFtpSshScp.html

0 Response to "Upload a File to a Machine With Telnet"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel