Skip to content
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

sftp subsystem ignores process umask when creating directory #535

Open
rde2 opened this issue Jul 22, 2024 · 1 comment
Open

sftp subsystem ignores process umask when creating directory #535

rde2 opened this issue Jul 22, 2024 · 1 comment

Comments

@rde2
Copy link

rde2 commented Jul 22, 2024

Version

2.12.0

Bug description

Connect to mina sshd sftp server using normal sftp client. Use "mkdir" to create a directory. The directory is created with mode 777 (rwxrwxrwx). The process umask (0022 or 0027) should prevent "write by others" being set.

The directory is created with the correct mode then this is overridden in doMakeDirectory

Actual behavior

The directory is created with mode 777 (rwxrwxrwx).

Expected behavior

he directory is created without write by others permission.

Relevant log output

No response

Other information

No response

@tomaswolf
Copy link
Member

The draft RFCs for SFTP versions 3, 4, and 5 are silent on this matter. For SFTP version 6, the draft RFC says

The server SHOULD NOT apply a 'umask' to the mode bits; but should set the mode bits as specified by the client. The client MUST apply an appropriate 'umask' to the mode bits before sending them. draft-ietf-secsh-filexfer-07

OpenSSH does let the system apply the umask, and its SFTP server can even be run with a custom umask that overrides the system umask. OpenSSH implements SFTP version 3.

Maybe the Apache MINA SFTP server part should have a setting for this for SFTP version < 6.

(Seems more of a feature request than a bug.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants