Nishant Gupta
Nishant Gupta

Reputation: 63

chmod method in SFTPClient of sshj-0.27.0.jar is corrupting the file permissions

I am trying to change the permission of a file to 555 using the SFTPClient.chmod method and this seems to be corrupting the file permissions. For eg. the file permission before the execution of this method was "-rw-r--r--" and after the execution is "----r-x-wt". Is there some problem with the jar? Any help is appreciated.

PS: I have observed the same behaviour with sshj-0.30.0.jar as well.

import net.schmizz.sshj.SSHClient;
import net.schmizz.sshj.sftp.SFTPClient; 

SSHClient ssh = <>; // get the SSHClient
SFTPClient sftp = ssh.newSFTPClient(); 
sftp.chmod(filename, 555); 

Upvotes: -1

Views: 587

Answers (1)

Nishant Gupta
Nishant Gupta

Reputation: 63

Decimal 555 translates to 1000101011 but we want 101101101. So, 0555 is the correct way here.

Upvotes: 0

Related Questions