Skip to content

Commit

Permalink
Fixed all sftp actions.
Browse files Browse the repository at this point in the history
On ubuntu sftp-server is not at the same place as on gentoo machines. The
enhanced sshd_config did not account for that.
  • Loading branch information
lkastner committed May 5, 2015
1 parent be2f7b4 commit a57ce15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion separate_machines/docker/sshd_config
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ UseDNS no
#Banner none

# override default of no subsystems
Subsystem sftp /usr/lib64/misc/sftp-server
Subsystem sftp /usr/lib/openssh/sftp-server

# the following are HPN related configuration options
# tcp receive buffer polling. disable in non autotuning kernels
Expand Down
9 changes: 6 additions & 3 deletions src/lib/fileUpload.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ var SocketIOFileUpload = require('socketio-file-upload');
module.exports = function (clients, logExceptOnTest, sshCredentials) {
var completeFileUpload = function (clientId) {
return function (event) {
var credentials = sshCredentials(clients[clientId].instance);
var connection = ssh2();

connection.on('end', function () {
});

connection.on('ready', function () {
connection.sftp(function (err, sftp) {
console.log("Have stream.");
if(err){
console.log("There was an error while connecting via sftp: " + err);
}
var stream = sftp.createWriteStream(event.file.name);
stream.write(clients[clientId].fileUploadBuffer.toString());
stream.end(function () {
Expand All @@ -20,8 +23,8 @@ module.exports = function (clients, logExceptOnTest, sshCredentials) {
clients[clientId].fileUploadBuffer = "";
});
});
console.log(sshCredentials(clients[clientId].instance));
connection.connect(sshCredentials(clients[clientId].instance));

connection.connect(credentials);
};
};

Expand Down

0 comments on commit a57ce15

Please sign in to comment.