CS 3723
Programming Languages 
  Accessing UTSA from
  a Remote Computer
  


Sessions using the Secure Shell (shh) and the secure file transfer (sftp): This page explains how a person working entirely at home could interact with the elkxx computers at UTSA. This is the old-fashioned way that I use to work from home, using command-line programs ssh and sftp. The programs are provided by default for Linux and Apple's Mac OS X. Below is an interactive session illustrating access to a CS elk machine from my Linux. Here a (non-existent) student named "Ned Wagner" wants to upload a file "rec1.txt" into an account at UTSA. The student's account is "nwagner". (From now on, student account names will have the 3-letter, 3-digit form.) He has a file already prepared on his computer at home. He needs to get this file into the CS system. I will show two strategies:

  1. Copy-paste the file into an editor (say vi at UTSA). I don't recommend this.
  2. Use sftp, the secure file transfer, to transfer the file to UTSA.

These applications are available on Windows, usually as window-based programs. There are versions that are much fancier than the low-level programs discussed here.


Interactive Session Using Secure Shell and an Editor: The purple text is what Ned Wagner types in. Black is what the system responds with. The orange text makes up comments, not typed in, and not appearing at all in the session.

neal@linux-d8ag:~> date  # date command
Sat Jan 28 08:30:54 CST 2012
neal@linux-d8ag:~> ssh nwagner@elk05.cs.utsa.edu # secure shell to elk05
nwagner@elk05.cs.utsa.edu's password: # crap! used my other password
Permission denied, please try again.
nwagner@elk05.cs.utsa.edu's password: # OK, this worked
# the system may demand that you respond "yes" to a question about security
elk05:~> pwd             # show current directory
/home/nwagner
elk05:~> ls              # list contents
CS3343  mbox  public_html  working
elk05:~> cd public_html  # change directories
elk05:~/public_html> ls  # list contents
index.htm
elk05:~/public_html> mkdir rec1   # make a new directory
elk05:~/public_html> cd rec1   # change to this new directory
elk05:~/public_html/rec1> vi rec1.txt   # create a new file at UTSA
# first "i" is for "insert".  Then I pasted in my prepared rec1.txt file
iIn all men's lives at certain periods, a dominate element is the desire
to be inside the local Ring and terror of being left outside.  Of all the
passions the passion for the Inner Ring is most skilful in making a man
who is not yet a very bad man do very bad things.
-- C.S. Lewis, "The Inner Ring" (1944) <Esc>
# <Esc> terminates input mode
ZZ   # ZZ command saves file and quits vi
elk05:~/public_html/rec1> ls -l   # get long form of file list
-rw-r--r-- 1 wagner faculty 308 2013-12-20 14:00 rec1.txt  # file's there
elk05:~/public_html/rec1> logout
Connection to elk05.cs.utsa.edu closed.
neal@linux-d8ag:~>   # there's no place like home


Interactive Session Using Secure File Transfer: Here I show how to use sftp to transfer files from a remote Linux to an elk machine. This assumes you have a rec1.txt file at home that you want to submit. You need to get the file into the CS network.

neal@linux-d8ag:~> pwd                 # which directory am I in
/home/neal                             # linux, at home directory
neal@linux-d8ag:~> cd public_html      # move locally on to public_html
neal@linux-d8ag:~/public_html> cd rec1 # move on to rec1
neal@linux-d8ag:~/public_html/rec1> ls # list files
rec1.txt   # rec1.txt is already prepared, at home, ready to submit
neal@linux-d8ag:~/public_html/rec1> cat rec1.txt   # display contents of rec1.txt
... genes that tend to make children cheat have an advantage
in the gene pool.  If there is a moral to be drawn, it is that
we must _teach_ our children altruism, for we cannot expect
it from their biological nature.
Richard Dawkins, "The Selfish Gene"
neal@linux-d8ag:~/public_html/rec1> cd ..   # drop out rec1 directory
neal@linux-d8ag:~/public_html> 
neal@linux-d8ag:~/public_html> sftp nwagner@elk06.cs.utsa.edu # initiate secure ftp
The authenticity of host 'elk06.cs.utsa.edu (129.115.28.166)' can't be established. 
RSA key fingerprint is ea:74:d6:0e:02:54:a6:51:53:31:92:60:a9:9f:da:82.
Are you sure you want to continue connecting (yes/no)? yes  # need first time
Warning: Permanently added 'elk06.cs.utsa.edu,129.115.28.166'
(RSA) to the list of known hosts.
nwagner@elk06.cs.utsa.edu's password: # correct password entered
Connected to elk06.cs.utsa.edu.
sftp> pwd                             # what remote directory am I in?
Remote working directory: /home/nwagner
sftp> lpwd                            # what local directory am I in?
Local working directory: /home/neal/public_html
sftp> cd public_html                  # move on to remote directory public_html 
sftp> pwd                             # what remote directory am I in?
Remote working directory: /home/nwagner/public_html
sftp> cd rec1                         # change to remote directory rec1
Couldn't canonicalise: No such file or directory   # change fails
sftp> lcd rec1                        # change to local directory rec1
sftp> ls                              # list remote files
index.htm  
sftp> lls                             # list local files
rec1.txt                              # we want to transfer this to the elk
sftp> pwd                             # forgot where I was remotely
Remote working directory: /home/nwagner/public_html
sftp> lpwd                            # forgot where I was locally
Local working directory: /home/neal/public_html/rec1
sftp> mkdir rec1                      # create new directory remotely for file
sftp> cd rec1                         # remote change to this new directory
sftp> pwd                             # check again remotely where I am
Remote working directory: /home/nwagner/public_html/rec1
sftp> put re1.txt                     # "put" transfers a file from local to remote
stat re1.txt: No such file or directory   # crap.  file name misspelled
sftp> pwd                             # check again remotely where I am
Remote working directory: /home/nwagner/public_html/rec1
sftp> lpwd                            # check again locally where I am
Local working directory: /home/neal/public_html/rec1
sftp> put rec1.txt                    # this "put" was successful
Uploading rec1.txt to /home/nwagner/public_html/rec1/rec1.txt # 252 bytes transferred
rec1.txt                                      100%  252     0.3KB/s   00:00    
sftp> quit                            # quit sftp
neal@linux-d8ag:~/public_html>        # click heels three times, get back

You can fetch files from the remote machine using get in the same way as put. The commands get and put allow stars (*) to be present, which stand for any non-whitespace characters. In this way you can transfer many files at once.

( Revision date: 2014-05-21. Please use ISO 8601, the International Standard.)