hierynomus / hierynomus/sshj

sftp download files with a sudo user

Open
#675 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.7k
Forks
620
Avg merge
3d 23h
Merged PRs (30d)
11

Description

Hi - I am downloading file(s) using sftp connection using a non-root user which has sudo access. There are certain files which get downloaded, but for few files we get permission denied. The issue seems to be the due to permission on the files.
While searching on internet, it was observed that sftp can be connected as a sudo user which eventually can download the file.
Is there any mechanism to get the SFTP client with elevated access like sudo.
sftp -s "sudo /usr/libexec/openssh/sftp-server" user@hostname:/var/log/filebeat/filebeat .

One alternative approach could be to copy files locally and then download the same, but this duplicates the work. For example
- cp /var/log/filebeat/filebeat ~/filebeat
- sftp user@hostname:~/filebeat .

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.