TrustCore SDK NanoSSH API reference  version 7.0
SFTP Server Security Context Initialization Functions

Functions

MOC_EXTERN sbyte4 SSH_sftpSetHomeDirectory (sbyte4 connectionInstance, sbyte *pHomeDirectory)
 Define an SFTP client's default home directory. More...
 
MOC_EXTERN sbyte4 SSH_sftpSetMemberOfGroups (sbyte4 connectionInstance, ubyte4 memberGroups)
 Set an individual SFTP user's permissions. More...
 

Detailed Description

Function Documentation

◆ SSH_sftpSetHomeDirectory()

MOC_EXTERN sbyte4 SSH_sftpSetHomeDirectory ( sbyte4  connectionInstance,
sbyte *  pHomeDirectory 
)

This function defines an SFTP client's default home directory. The function must be called during the SSH authentication phase.

Since
1.41
Version
1.41 and later

To enable this function, the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSH_FTP_SERVER__
  • __ENABLE_MOCANA_SSH_SERVER__
Parameters
connectionInstanceConnection instance returned from SSH_acceptConnection() or SSH_ASYNC_acceptConnection().
pHomeDirectoryPointer to string identifier for the user's home directory.

sftp.h

Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

sftp.c

◆ SSH_sftpSetMemberOfGroups()

MOC_EXTERN sbyte4 SSH_sftpSetMemberOfGroups ( sbyte4  connectionInstance,
ubyte4  memberGroups 
)

This function sets an individual SFTP user's permissions, granting or restricting read, write, and delete access to files and directories. The function should be called from within a custom authentication upcall.

Since
1.41
Version
1.41 and later

To enable this function, the following flags must be defined in moptions.h:

  • __ENABLE_MOCANA_SSH_FTP_SERVER__
  • __ENABLE_MOCANA_SSH_SERVER__
Parameters
connectionInstanceConnection instance returned from SSH_acceptConnection() or SSH_ASYNC_acceptConnection().
memberGroupsSum of bitmasks specifying desired file and directory access.

sftp.h

Returns
OK (0) if successful; otherwise a negative number error code definition from merrors.h. To retrieve a string containing an English text error identifier corresponding to the function's returned error status, use the DISPLAY_ERROR macro.

sftp.c