How to get sftp to respect my umask setting
I'm trying to get sftp to give me a umask of 002 but it keeps behaving like the umask is 022. How do I get it to do that?
Red Hat 7.4
/etc/ssh/sshd_config has the line:
Subsystem sftp internal-sftp -u 002
I've also tried
Subsystem sftp internal-sftp -u 0002
After each change I make to sshd_config I issue the following command:
sudo systemctl restart sshd.service
Then in a separate window I log into sftp.
Once I've uploaded the file in sftp, then "ls -Fla" in the shell session returns:
drwxrwsr-x. 2 [myID] [myGroup] 32 Dec 28 17:37 ./
drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
-rw-r--r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]
(last line having r-- as the group permission)
where I would expect:
drwxrwsr-x. 2 [myID] [myGroup] 32 Dec 28 17:37 ./
drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
-rw-rw-r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]
(last line having rw- as the group permission)
I've also tried
Subsystem sftp internal-sftp -u ug=rwx
but that one causes sftp to close the connection.
At least it confirms that I'm updating the right configuration file.
sftp umask
New contributor
add a comment |
I'm trying to get sftp to give me a umask of 002 but it keeps behaving like the umask is 022. How do I get it to do that?
Red Hat 7.4
/etc/ssh/sshd_config has the line:
Subsystem sftp internal-sftp -u 002
I've also tried
Subsystem sftp internal-sftp -u 0002
After each change I make to sshd_config I issue the following command:
sudo systemctl restart sshd.service
Then in a separate window I log into sftp.
Once I've uploaded the file in sftp, then "ls -Fla" in the shell session returns:
drwxrwsr-x. 2 [myID] [myGroup] 32 Dec 28 17:37 ./
drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
-rw-r--r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]
(last line having r-- as the group permission)
where I would expect:
drwxrwsr-x. 2 [myID] [myGroup] 32 Dec 28 17:37 ./
drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
-rw-rw-r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]
(last line having rw- as the group permission)
I've also tried
Subsystem sftp internal-sftp -u ug=rwx
but that one causes sftp to close the connection.
At least it confirms that I'm updating the right configuration file.
sftp umask
New contributor
add a comment |
I'm trying to get sftp to give me a umask of 002 but it keeps behaving like the umask is 022. How do I get it to do that?
Red Hat 7.4
/etc/ssh/sshd_config has the line:
Subsystem sftp internal-sftp -u 002
I've also tried
Subsystem sftp internal-sftp -u 0002
After each change I make to sshd_config I issue the following command:
sudo systemctl restart sshd.service
Then in a separate window I log into sftp.
Once I've uploaded the file in sftp, then "ls -Fla" in the shell session returns:
drwxrwsr-x. 2 [myID] [myGroup] 32 Dec 28 17:37 ./
drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
-rw-r--r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]
(last line having r-- as the group permission)
where I would expect:
drwxrwsr-x. 2 [myID] [myGroup] 32 Dec 28 17:37 ./
drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
-rw-rw-r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]
(last line having rw- as the group permission)
I've also tried
Subsystem sftp internal-sftp -u ug=rwx
but that one causes sftp to close the connection.
At least it confirms that I'm updating the right configuration file.
sftp umask
New contributor
I'm trying to get sftp to give me a umask of 002 but it keeps behaving like the umask is 022. How do I get it to do that?
Red Hat 7.4
/etc/ssh/sshd_config has the line:
Subsystem sftp internal-sftp -u 002
I've also tried
Subsystem sftp internal-sftp -u 0002
After each change I make to sshd_config I issue the following command:
sudo systemctl restart sshd.service
Then in a separate window I log into sftp.
Once I've uploaded the file in sftp, then "ls -Fla" in the shell session returns:
drwxrwsr-x. 2 [myID] [myGroup] 32 Dec 28 17:37 ./
drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
-rw-r--r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]
(last line having r-- as the group permission)
where I would expect:
drwxrwsr-x. 2 [myID] [myGroup] 32 Dec 28 17:37 ./
drwxrwxr-x. 4 [siteID] [siteGroup] 50 Dec 26 18:44 ../
-rw-rw-r--. 1 [myID] [myGroup] 9173334 Dec 28 17:37 [myUploadedFile]
(last line having rw- as the group permission)
I've also tried
Subsystem sftp internal-sftp -u ug=rwx
but that one causes sftp to close the connection.
At least it confirms that I'm updating the right configuration file.
sftp umask
sftp umask
New contributor
New contributor
New contributor
asked 27 mins ago
Charles Belov
1
1
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
In your sshd config file, try setting "ForceCommand" on your groups
Match Group {GROUP_NAME}
ForceCommand internal-sftp -u 0002
Restart your sshd process for the new settings to take effect
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Charles Belov is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491404%2fhow-to-get-sftp-to-respect-my-umask-setting%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In your sshd config file, try setting "ForceCommand" on your groups
Match Group {GROUP_NAME}
ForceCommand internal-sftp -u 0002
Restart your sshd process for the new settings to take effect
New contributor
add a comment |
In your sshd config file, try setting "ForceCommand" on your groups
Match Group {GROUP_NAME}
ForceCommand internal-sftp -u 0002
Restart your sshd process for the new settings to take effect
New contributor
add a comment |
In your sshd config file, try setting "ForceCommand" on your groups
Match Group {GROUP_NAME}
ForceCommand internal-sftp -u 0002
Restart your sshd process for the new settings to take effect
New contributor
In your sshd config file, try setting "ForceCommand" on your groups
Match Group {GROUP_NAME}
ForceCommand internal-sftp -u 0002
Restart your sshd process for the new settings to take effect
New contributor
New contributor
answered 11 mins ago
John
101
101
New contributor
New contributor
add a comment |
add a comment |
Charles Belov is a new contributor. Be nice, and check out our Code of Conduct.
Charles Belov is a new contributor. Be nice, and check out our Code of Conduct.
Charles Belov is a new contributor. Be nice, and check out our Code of Conduct.
Charles Belov is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f491404%2fhow-to-get-sftp-to-respect-my-umask-setting%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown