|
Class: SftpClient
Object
|
+--SftpClient
- Package:
- stx:goodies/communication
- Category:
- Net-Communication-SFTP
- Version:
- rev:
1.18
date: 2019/03/18 10:36:56
- user: stefan
- file: SftpClient.st directory: goodies/communication
- module: stx stc-classLibrary: communication
- Author:
- Stefan Vogel
SFTP client side using the sftp command of the operating system
(linux, unix).
Note, you cannot set the password here. Your client/user combination must be in the
authorized hosts file on the ssh server.
[instance variables:]
connection currently unused
hostname String Hostname or IP-Adress of the ssh server
port Integer TCP-Port number of the ssh-service
username String sftp user name
sourceIpAddress String the originating IP-Address (if you have several network interfaces)
protocolVersion currently unused
requestId currently unused
packetBuilder currently unused
[class variables:]
accessing
-
hostname
-
-
hostname: something
-
-
port
-
-
port: something
-
-
sourceIpAddress
-
-
sourceIpAddress: something
-
-
username
-
-
username: something
-
connecting
-
connectString
-
(self new hostname:'localhost'; username:'ftp') connectString
direct access
-
cd: remotePath
-
self new hostname:'exeptn.bh.exept.de'; cd:'/tmp'
-
copyLocal: localFilename to: remoteFilename
-
self new hostname:'exept.exept.de'; copyLocal:'/etc/hosts' to:'/tmp'
-
copyRemote: remoteFilename to: localFilename
-
self new hostname:'exept.exept.de'; copyRemote:'/etc/hosts' to:'/tmp'
-
directoryContentsOf: remoteFilename
-
this is the command
usage example(s):
self new hostname:'exeptn'; directoryContentsOf:''
self new hostname:'exeptn'; directoryContentsOf:'/home/stefan'
self new hostname:'exeptn'; directoryContentsOf:'/glump'
|
-
mkdir: remoteFilename
-
self new hostname:'exeptn'; mkdir:'/tmp/test'
-
nlist
-
self new hostname:'exeptn'; nlist
-
pwd
-
this is the command
-
remove: remoteFilename
-
self new hostname:'exept.exept.de'; remove:'/tmp/hosts'
-
rename: existingRemoteFilename to: newRemoteFilename
-
self new hostname:'exept.exept.de'; rename:'/tmp/hosts' to:'/tmp/h'
-
safeCopyLocal: localFilename to: remoteFilename
-
same as copyLocal, but use an intermediate file
-
sftpCommand: sftpCommand
-
Solaris ssh does not support '-b -' yet (2007-10-16)
-
version
-
this is the command
usage example(s):
self new hostname:'exeptn.bh.exept.de'; version
|
errors
-
protocolError: description with: sftpPacket
-
reading packets
-
getNextPacket
-
read the next packet and return it without the length field
stream access
-
getStreamFor: aFilenameString
-
unimplemented native protocol (future)
-
close
-
-
connect
-
currently unused.
Use #host: and #user: to set the connection parameters and
the do your commnds
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
connection
-
-
connection: something
-
-
directoryContentsFromHandle: sftpHandle
-
|sftpConnection|
sftpConnection := (self new hostname:'exept.exept.de') connect.
[
(sftpConnection openDirectory:'/etc') directoryContents
] ensure:[
sftpConnection close
]
-
initialHandshake
-
version number
-
nextRequestId
-
answer the next unused requestId. Wrap around.
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
openDirectory: aFilenameString
-
(self new hostname:'exept.exept.de') connect openDirectory:'/etc'
-
openFile: aFilenameString
-
desired-access
usage example(s):
(self new hostname:'exept.exept.de') connect openFile:'/etc/hosts'
|
SftpHandle
SftpPacketBuilder
|