hierynomus / hierynomus/sshj

SCP upload file permission

Open
#492 1 comment 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'm trying to figure out how to upload a local file via scp and set desired file permission.
My simplified code is following:
```
SSHClient sshClient = new SSHClient(defaultConfig);
sshClient.connect(ip);
sshClient.authPassword(user, password);

FileSystemFile fileSystemFile = new FileSystemFile(sourceFile);
fileSystemFile.setPermissions(mode); // integer

sshClient.newSCPFileTransfer().upload(fileSystemFile, targetFileDir);
```
Method FileSystemFile.setPermissions() accepts integer. But if I pass _777_ or _0777_ resulting file has permissions _511_. I suppose due to octal-decimal conversion. Javadoc for method clearly says to use format with leading zero.

Is there way to specify permissions? For example using ```net.schmizz.sshj.xfer.FilePermission``` enum?

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.