eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'SftpClient':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: SftpClient


Inheritance:

   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

Description:


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:]


Related information:



Instance protocol:

accessing
o  hostname

o  hostname: something

o  port

o  port: something

o  sourceIpAddress

o  sourceIpAddress: something

o  username

o  username: something

connecting
o  connectString
(self new hostname:'localhost'; username:'ftp') connectString

direct access
o  cd: remotePath
self new hostname:'exeptn.bh.exept.de'; cd:'/tmp'

o  copyLocal: localFilename to: remoteFilename
self new hostname:'exept.exept.de'; copyLocal:'/etc/hosts' to:'/tmp'

o  copyRemote: remoteFilename to: localFilename
self new hostname:'exept.exept.de'; copyRemote:'/etc/hosts' to:'/tmp'

o  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'

o  mkdir: remoteFilename
self new hostname:'exeptn'; mkdir:'/tmp/test'

o  nlist
self new hostname:'exeptn'; nlist

o  pwd
this is the command

o  remove: remoteFilename
self new hostname:'exept.exept.de'; remove:'/tmp/hosts'

o  rename: existingRemoteFilename to: newRemoteFilename
self new hostname:'exept.exept.de'; rename:'/tmp/hosts' to:'/tmp/h'

o  safeCopyLocal: localFilename to: remoteFilename
same as copyLocal, but use an intermediate file

o  sftpCommand: sftpCommand
Solaris ssh does not support '-b -' yet (2007-10-16)

o  version
this is the command

usage example(s):

        self new hostname:'exeptn.bh.exept.de'; version

errors
o  protocolError: description with: sftpPacket

reading packets
o  getNextPacket
read the next packet and return it without the length field

stream access
o  getStreamFor: aFilenameString

unimplemented native protocol (future)
o  close

o  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) **

o  connection

o  connection: something

o  directoryContentsFromHandle: sftpHandle
|sftpConnection|

sftpConnection := (self new hostname:'exept.exept.de') connect.
[
(sftpConnection openDirectory:'/etc') directoryContents
] ensure:[
sftpConnection close
]

o  initialHandshake
version number

o  nextRequestId
answer the next unused requestId. Wrap around.

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  openDirectory: aFilenameString
(self new hostname:'exept.exept.de') connect openDirectory:'/etc'

o  openFile: aFilenameString
desired-access

usage example(s):

        (self new hostname:'exept.exept.de') connect openFile:'/etc/hosts'  


Private classes:

    SftpHandle
    SftpPacketBuilder


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Fri, 26 Apr 2024 12:58:20 GMT