|
Class: SftpClient
Object
|
+--SftpClient
- Package:
- stx:goodies/communication
- Category:
- Net-Communication-SFTP
- Version:
- rev:
1.25
date: 2023/09/07 10:26:48
- user: cg
- file: SftpClient.st directory: goodies/communication
- module: stx stc-classLibrary: communication
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:]
copyrightCOPYRIGHT (c) 2005 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
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
then 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.
-
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
|