Warning for other Rebex users.
Please use the overloads of the method SetFileSystem when you need to set a user root directory in the virtual file system.
user.SetFileSystem(userDirectoryFS); //see answer above for details
API Doc - https://www.rebex.net/doc/api/Rebex.Net.Servers.FileServerUser.SetFileSystem.html
RussPhillips is right, but you should be aware that the following line is a "hack" and unintended consequence, which originated from the integration of the virtual file system to the SFTP server.
var user = new FileServerUser(userName, userPassword, "/", "/user1");
The line above allows access to the root "/" of the physical file system (e. g. C:\ on Windows). The access will be typically revoked a few lines later using the SetFileSystem call, so we can conclude that the final user of the application is neither aware of this temporary setting nor can get access to the sensitive parts of the physical file system. Despite the seemingly innocent nature of the code, to avoid potential leaking of the sensitive information if you forget to set the virtual file system (after refactoring of the code, etc.), we strongly recommend (solution specific equivalent of the) following code.
var userDirectory = azureFs.Root.GetDirectories()
.SingleOrDefault(dir => dir.Name.Equals("user1", StringComparison.OrdinalIgnoreCase));
//Every directory in the file system can serve as a FileSystemProvider.
//Use the CreateFileSystem method and you are done.
var userDirectoryFS = userDirectory.CreateFileSystem();
var user = new FileServerUser(userName,userPassword);