Ssh Sftp



  1. Ssh Sftp Openssh
  2. Ssh Sftp Linux

Many Unix environments have the command-line SSH and SFTP client software tools installed. This page is intended as a guide to just the basics of using these command-line tools. They have many more features than what is described here -- but these instructions should get you started.

SSH key pairs allow an additional level of security that can be used in conjunction with the SFTP protocol. Key pairs are typically created by the client, and then the resulting public key is used by Core FTP Server. Core FTP products use the OpenSSH SSH2 format, that can be generated using Core FTP software, or via the ssh-keygen utility. Secure Shell (SSH) creates a secure connection when you log in to a remote computer. Secure File Transfer Protocol (SFTP) uses SSH and provides a secure way to transfer files between computers. You must use SSH or SFTP when connecting to the University's Unix Timesharing Service.

SFTP - SSH SFTP (SSH File Transfer Protocol) is a network protocol that provides file access, file transfer, and file management over any reliable data stream. It was designed by the Internet Engineering Task Force (IETF) as an extension of the Secure Shell protocol (SSH) version 2.0 to provide secure file transfer capabilities. SFTP (SSH File Transfer Protocol) is a secure file transfer protocol. It runs over the SSH protocol. It supports the full security and authentication functionality of SSH. SFTP has pretty much replaced legacy FTP as a file transfer protocol, and is quickly replacing FTP/S. It provides all the functionality offered by these protocols, but more.

Where would I use these?

CS account

  • If you have a CS account, you have access to at least three machines you can log into:
    • shell.cs.fsu.edu
    • program.cs.fsu.edu
    • linprog.cs.fsu.edu
    These machines all mount your home directory, so there's no need to SFTP between them.
  • You might also have an account on websrv2.cs.fsu.edu. This would not mount your normal CS account directory, so you might need to file transfer between this machine and others

Mac OS X home computer / laptop

  • If you have a Macintosh laptop or home computer running OS X, you cannot use the Windows SSH client unless you're running Windows emulation or have booted into Windows
  • In this case, you can use the terminal application (which takes you into a Unix prompt on your Mac) and run the command line SSH and SFTP programs from there
  • This is useful for logging into your CS account remotely, as well as doing file transfers between your Mac and your CS account
  • To open the terminal application on a Mac:
    • Go to the spotlight icon in the upper right of your desktop
    • In the search box, type 'terminal'
    • A menu choice for the terminal application should appear. Select this

Using command-line SSH

Login format:In this format, username refers to your user name on the remote account you are logging into, and host_name refers to the name of the machine (usually along with doman) that you are logging into

If you leave out the username, the command will assume that you are logging into another machine with the same username as the machine you're currently on.

Examples

  • Suppose I'm on a Mac, logged in with user account 'john'.
    This command would log me into shell.cs.fsu.edu as username 'smith':This command would log me into shell.cs.fsu.edu, attempting username 'john' (probably will fail, since john is probably not your CS account username!):
  • You can also log into the machines program or linprog:

Using Command-Line SFTP

SFTP is Secure File Transfer Protocol. It is similar to ssh, but its primary purpose is to enable file transfers between a local machine and a remote machine, whereas the ssh (Secure Shell) protocol is for opening up a general command shell on a remote machine where you have an account.

The login format for command line sftp is exactly the same as with the ssh command, but with the 'sftp' command:Using the same basis of the prior example, this command would log me into shell.cs.fsu.edu with the sftp (file transfer) program as username 'smith':

Local vs. Remote machines

Before you transfer files, make sure you know the difference between the local and SftpremoteSsh/sftp machines:
  • The local machine is the one you started from -- i.e. the machine you were on when you typed the 'sftp' command. This might be your actual physical computer, like a MacBook, if you're using the terminal application. This might also be a machine you are logged into through ssh
  • The remote machine is the one you just logged into via the sftp command

Examples

  • Suppose I'm on my MacBook, with username john. I open the terminal application and sftp into linprog.cs.fsu.edu with username smith:In this case, the local machine is my MacBook, and the remote machine is linprog
  • Suppose I've already logged into user account smith on shell.cs.fsu.edu through an ssh command (or any SSH client). From my CS account, I type this command:Now I have logged into the machine websrv2, with the same user account smith. In this case, the local machine is shell.cs.fsu.edu, and the remote machine is websrv2.cs.fsu.edu.

Basic file transfer commands

There are more commands available than this, but the primary commands you will need are:

Ssh Sftp Openssh

  • put -- copy a file from the local machine to the remote machine
  • get -- copy a file from the remote machine to the local machine
  • ls -- get a directory listing on the remote machine
  • cd -- change your current working directory on the remote machine
  • lls -- get a directory listing on the local machine
  • lcd -- change your current working directory on the local machine
Note here that the ls (list files) and cd (change directory) commands work exactly as you are used to them from a regular unix shell. Except when you use them as-is, you are requesting a listing or a change directory operation on the remote machine -- i.e. the machine you just sftp-ed into.

If you want to get a directory listing or change directories on the local machine, use the lls (local list files) and lcd (local change directory) commands instead.

I'm not going to describe these commands (listing and change directories) any further, as readers of this file should already be familiar with these unix commands

put and get commands

Once you have used the listing and navigation commands to put yourself in the correct directories, use get to retrieve files from the remote machine to the local account, and use putSsh sftp commandsSsh sftp client to send files from your local account to the remote account. The formats of these commands are simple, and you may use unix wildcards.

Format:Note that the second parameter of each command is optional -- and it will serve to specify a different name or destination directory for the transferred file. Most of the time, it's easiest to simply use put and get with a single parameter, and the destination will default to the current remote or local directory, respectively.

Examples

  • This command will copy the file mycode.cpp from the remote machine to the local one:
  • This command will copy the file mypaper.doc from the local machine to the remote one:
  • This command will copy the file assign1.cpp from the remote machine, and save it as smith1.cpp on the local machine:
  • This command will copy all files ending in .cpp in the current directory on the local machine to the remote machine:

Other SFTP commands

To see a full list of SFTP commands and their formats, you can type help when you are logged in via

Ssh Sftp Linux

sftp, and it will give you a list of available commands.

To exit the sftp login, you can use either the quit or the exit command.