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.25 date: 2023/09/07 10:26:48
user: cg
file: SftpClient.st directory: goodies/communication
module: stx stc-classLibrary: communication

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

copyright

COPYRIGHT (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.

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
then 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.

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.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 15:40:01 GMT