ssh
, scp
and
sftp
The ssh program provides secure remote-login from the Unix command-line interface (CLI) over an unsecured network. The ssh command syntax looks like this:
$ ssh [user@]host
Where host is the
name of the remote network computer to which you want to login, and
user
is the name of the
user on that host.
[user@]
is written within square brackets ([]
) since
if the user name on the machine from which the connection is being made is the
same as the user name on the host it can be omitted.
The scp program provides a secure means of transfering files between networked computers using the Unix command-line interface (CLI) over an unsecured network.
The scp command syntax looks like this:
$ scp sourcefile [user@]host:path/targetfile
sftp
is a subsystem of ssh
intended to replace the
older, File
Transfer Protocol (FTP) which is not secure and is increasingly not
supported for this reason.
sftp
to transfer filesSuccessfully connecting to a remote machine with:
$ sftp [user@]host
will give you a prompt like this:
sftp>
From here, you can use the following commands to list files on both the local and remove machines move files back and forth between them:
[remote path]/filename
[local path][remote path] (defaults to current working
directory if not included) on the remote to [local path] (defaults to
current working directory if not included) on the local machine.
[remote path]/filename matching pattern
[local path]
[remote path]
(defaults to current working directory if not
included) on the remote machine to [local path]
(defaults to
current working directory if not included) on the local machine.[local path]/local filename
[remote path][local path]
(defaults
to current working directory if not included) to [remote path]
(defaults to current working directory if not included) on the remote machine.
[local path]/[local filename matching pattern]
[remote path][local filename matching pattern]
located at [local path]
] to [remote path]
on the
remote machine.Note: The following exercises assume availability of a remote unix host to which you can login.
ssh
command to login to a remote host. Write down
the exact command you used to do this.
scp
command to copy an image file from your local
machine to the same remote host you logged into in the previous exercise.
Then use ssh
to log back into the remote host and use the
ls
to confirm that your image file has been copied there.