The sftp client is used to connect to any SFTP server. It operates much like the standard ftp client, but cannot be used to connect to a ftp server. With the logging and batchfile options, sftp sessions can be completely automated.
USAGE
sftp [-1vC] [-A Password] [-b batchfile] [-L logfilename] [-osshopt=value] [user@]host[:file [file]]
The host must be given on the command line. The current interactive username will be used unless a user id is passed on the command line. This is done by adding the desired username to the hostname with the @ symbol. For example to connect to sftpserver as administrator, connect with
sftp administrator@sftpserver
OPTIONS
|
1 |
use the SSH1 protocol |
|
v |
verbose mode for debugging |
|
C |
use compression |
|
A Password |
use password to logon to sftp server |
|
b batchfile |
automation file - list desired commands to process after connected |
|
L logfilename |
allows commands and responses to be logged to file logfilename |
|
o sshoptions |
ssh client options |
AVAILABLE COMMANDS
|
! |
escape to the shell |
|
!command |
Execute 'command' in local shell |
|
cd |
change remote working directory |
|
chmod |
change file permissions of remote file |
|
chown own path |
Change owner of file 'path' to 'own' |
|
chgrp grp path |
Change group of file 'path' to 'grp' |
|
exit |
terminate ftp session and exit |
|
get/mget |
receive one/multilple file |
|
help |
print local help information |
|
lcd |
change local working directory |
|
lls/ldir |
Display local directory listing |
|
ln oldpath newpath |
Symlink remote file |
|
lmkdir path |
Create local directory |
|
lpwd |
Print local working directory |
|
ls |
list contents of remote directory |
|
lumask umask |
Set local umask to 'umask' |
|
mkdir |
make directory on the remote machine |
|
put/mput |
send one/multiple file |
|
pwd |
print working directory on remote machine |
|
quit |
terminate ftp session and exit |
|
rename |
rename file |
|
rmdir |
remove directory on the remote machine |
|
rm path |
delete remote file |
|
symlink oldpath newpath |
Symlink remote file |
|
version |
Show SFTP version |
|
? |
print local help information |
Status Messages
Each command processed by sftp will return an response. The codes for these responses are:
000 Success
001 End of file reached
002 File or DIrectory not found
003 Permission Denied
004 SFTP Internal Error
005 SFTP Protocol Error
006 No SFTP Connection
007 SFTP Connection Dropped
008 Unsupported SFTP Command
Each command will also list as STARTED and COMPLETED. These responses are designed for easy parsing to read log files for successful automated sessions.