Hi,
using the TScSFTPServer via TScSSHServer (6.2): it look's like:
SFTPServer := TScSFTPServer.Create(nil);
ScFileStorage := TScFileStorage.Create(nil);
ScSSHServer := TScSSHServer.Create(nil);
ScSSHServer.SFTPServer := SFTPServer;
ScSSHServer.Storage := ScFileStorage;
..... Port 22 --- Options ect.
then:
scUser := TScUser.Create(ScFileStorage.Users);
scUser.UserName := 'User1';
scUser.Password := '123456';
scUser.Authentications := [uaPassword];
scUser.HomePath := 'C:\Home\User1';
****
Running this Code (maybe in "SimpleSSHServer-Demo") and Login via WinSCP (Connection SFTP)
--- Results after login:
1. in WinSCP I see the 'C:\Home\User1' Folder - OK
2. The Folder 'C:\Home\User1' is not the Root-Folder - !Ok
3. User1 can Change to the topfolders .. "C:\Home" - "C:\" .... - !Ok
4. Get a file from this Folder - OK
5. Save a file to this Folder - !Ok (WinSCP - error-message)
- path to copy is "C:\Home\User1\./*.*"
- error mess is : Can't create the file -> bad filename (code 4)
Where is the mistake? How can I solve this problem?
May be it is a bug in WinSCP:
- when I change the directory in WinSCP to "/"[Root] then the protocol works fine
- may be -- set "OnGetAbsolutePath" for ever "on Root"
Andy
Session = SSH-2
Implementation = Devart-6.0
algorithm = aes
Compression = No
Protocol = SFTP-5
TScSFTPServer - RootPath (HomePath) for User
Re: TScSFTPServer - RootPath (HomePath) for User
////////// only Root to Users "HomePath":
procedure ScSFTPServer1GetAbsolutePath(Sender: TObject;
SFTPSessionInfo: TScSFTPSessionInfo; const Path: String;
const Control: TScSFTPRealpathControl; ComposePath: TStringList;
var AbsolutePath: String; var Error: TScSFTPError);
var AScSFTPError: TScSFTPError;
begin
AScSFTPError.ErrorCode := erOk;
AScSFTPError.ErrorMessage := '';
Error := AScSFTPError;
AbsolutePath := '/';
end;
//////////
procedure ScSFTPServer1GetAbsolutePath(Sender: TObject;
SFTPSessionInfo: TScSFTPSessionInfo; const Path: String;
const Control: TScSFTPRealpathControl; ComposePath: TStringList;
var AbsolutePath: String; var Error: TScSFTPError);
var AScSFTPError: TScSFTPError;
begin
AScSFTPError.ErrorCode := erOk;
AScSFTPError.ErrorMessage := '';
Error := AScSFTPError;
AbsolutePath := '/';
end;
//////////
Re: TScSFTPServer - RootPath (HomePath) for User
Thank you for the information. We are investigating the problem. As soon as we solve the problem we will let you know.
-
- Posts: 1
- Joined: Wed 04 Jun 2014 09:53
Re: TScSFTPServer - RootPath (HomePath) for User
hello, I'm trying to run a sftp server but I too have the same problem.
Where can I set the root sftp?
The server sets it where the executable resides, and returns to the sftp client that path instead of a root.
I'm using the last trial with XE6 under Windows 7.
Where can I set the root sftp?
The server sets it where the executable resides, and returns to the sftp client that path instead of a root.
I'm using the last trial with XE6 under Windows 7.
Re: TScSFTPServer - RootPath (HomePath) for User
Thank you for the information. We have reproduced this problem and fixed it. This fix will be included in the next SecureBridge build.