Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Allow alternate sftp-server paths for client connections #1296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
joaomariord wants to merge 2 commits into mscdex:master
base: master
Choose a base branch
Loading
from joaomariord:sftp-subsystem

Conversation

@joaomariord
Copy link

@joaomariord joaomariord commented May 12, 2023

This PR allows the client to select an alternate path for clients to connect sftp to.

A usage of this SSH facility is to use alternate sftp-servers or to do privilege escalation on systems that support it, the OpenSSH SFTP tool supports this with the -s flag.

Usage (in OpenSSH SFTP):
sftp -s "/usr/bin/sudo /usr/libexec/sftp-server" -p 22 frylock@192.168.100.100

Usage in SSH2 lib:

const { Client } = require('ssh2');
const conn = new Client();
conn.on('ready', () => {
 console.log('Client :: ready');
 conn.sftp((err, sftp) => {
 if (err) throw err;
 sftp.readdir('foo', (err, list) => {
 if (err) throw err;
 console.dir(list);
 conn.end();
 });
 }, { command: '/usr/bin/sudo /usr/libexec/sftp-server' } );
}).connect({
 host: '192.168.100.100',
 port: 22,
 username: 'frylock',
 password: 'nodejsrules'
});

chzager and Coding-Kiwi reacted with thumbs up emoji
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /