diff --git a/src/common-ssh/sftp.c b/src/common-ssh/sftp.c index 4a6f7716a..6db67944d 100644 --- a/src/common-ssh/sftp.c +++ b/src/common-ssh/sftp.c @@ -409,7 +409,7 @@ int guac_common_ssh_sftp_handle_file_stream( /* Open file via SFTP */ file = libssh2_sftp_open(filesystem->sftp_session, fullpath, LIBSSH2_FXF_WRITE | LIBSSH2_FXF_CREAT | LIBSSH2_FXF_TRUNC, - S_IRUSR | S_IWUSR); + user->sftp_attr_permissions); /* Inform of status */ if (file != NULL) { diff --git a/src/libguac/guacamole/user.h b/src/libguac/guacamole/user.h index 13fb146d4..5f0f3b022 100644 --- a/src/libguac/guacamole/user.h +++ b/src/libguac/guacamole/user.h @@ -214,6 +214,8 @@ struct guac_user { */ guac_object* __objects; + int sftp_attr_permissions; + /** * Arbitrary user-specific data. */ diff --git a/src/protocols/ssh/settings.c b/src/protocols/ssh/settings.c index 48e7383bd..7cf94210e 100644 --- a/src/protocols/ssh/settings.c +++ b/src/protocols/ssh/settings.c @@ -47,6 +47,7 @@ const char* GUAC_SSH_CLIENT_ARGS[] = { "sftp-root-directory", "sftp-disable-download", "sftp-disable-upload", + "sftp-attr-permissions", "private-key", "passphrase", "public-key", @@ -148,6 +149,8 @@ enum SSH_ARGS_IDX { */ IDX_SFTP_DISABLE_UPLOAD, + IDX_SFTP_ATTR_PERMISSIONS, + /** * The private key to use for authentication, if any. */ @@ -449,6 +452,10 @@ guac_ssh_settings* guac_ssh_parse_args(guac_user* user, guac_user_parse_args_boolean(user, GUAC_SSH_CLIENT_ARGS, argv, IDX_SFTP_DISABLE_UPLOAD, false); + settings->sftp_attr_permissions = + guac_user_parse_args_int(user, GUAC_SSH_CLIENT_ARGS, argv, + IDX_SFTP_ATTR_PERMISSIONS, false); + #ifdef ENABLE_SSH_AGENT settings->enable_agent = guac_user_parse_args_boolean(user, GUAC_SSH_CLIENT_ARGS, argv, diff --git a/src/protocols/ssh/settings.h b/src/protocols/ssh/settings.h index 654046183..c232dc1b2 100644 --- a/src/protocols/ssh/settings.h +++ b/src/protocols/ssh/settings.h @@ -81,6 +81,8 @@ typedef struct guac_ssh_settings { */ int timeout; + int sftp_attr_permissions; + /** * The name of the user to login as, if any. If no username is specified, * this will be NULL.