Quantcast
Channel: Rebex Q&A Forum - Recent questions and answers
Viewing all articles
Browse latest Browse all 3902

Answered: How Do I Use Shell.Empty in FTP Server?

$
0
0

At the moment the default built-in shell commands
that we support are only the SCP commands*, and you have to set a virtual root for the user, otherwise it will not work.
Please try this code to create a SFTP server that by default implements SCP shell commands and let me know whether it helps:

// create a server instance
var server = new FileServer();

// bind virtual shell with SCP support (runs over SSH) to port 22
server.Bind(22, FileServerProtocol.Shell);

// load a server private key from encrypted 'serverkey.ppk' file
server.Keys.Add(new SshPrivateKey("server-key.ppk", "password"));

// add a user (specify username, password and virtual root path)
server.Users.Add("user01", "password", @"c:\data\user01");

// start the server in the background
server.Start();

With the code above you can still implement the FileServer.ShellCommand event handler and implement a new command or override the behaviour of an existing one.
As to the source code version it is available, but not directly from the webpage. If you are interested in purchasing it, please send us an email to support@rebex.net.

*As of Rebex File Server 2016 R2.2, the list of SCP supported commands is:
whoami, uname, hostname, echo, mv, rm, pwd, mkdir, rmdir, dir, cp, ls, groups, cd, set, exit, help)


Viewing all articles
Browse latest Browse all 3902

Trending Articles