How to get sftp to respect my umask setting
Clash Royale CLAN TAG#URR8PPP
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
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
Are you sure the remote umask is the problem? Your SFTP client may be setting explicit permissions on the remote file.
– Kenster
Dec 29 '18 at 19:09
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
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
asked Dec 29 '18 at 1:47
Charles BelovCharles Belov
61
61
Are you sure the remote umask is the problem? Your SFTP client may be setting explicit permissions on the remote file.
– Kenster
Dec 29 '18 at 19:09
add a comment |
Are you sure the remote umask is the problem? Your SFTP client may be setting explicit permissions on the remote file.
– Kenster
Dec 29 '18 at 19:09
Are you sure the remote umask is the problem? Your SFTP client may be setting explicit permissions on the remote file.
– Kenster
Dec 29 '18 at 19:09
Are you sure the remote umask is the problem? Your SFTP client may be setting explicit permissions on the remote file.
– Kenster
Dec 29 '18 at 19:09
add a comment |
2 Answers
2
active
oldest
votes
Notice that umask
values only reduce permissions, never adds them.
So if your local file was permission 0644 (-rw-r--r--) then the umask will not add a group write flag. The umask will remove "other write"; so if your local file was 0666 then the remote would be 0664.
If you want to ensure the remote file has group write then you might want the -m 664
flag instead.
Confirmed, thank you. Solved!
– Charles Belov
Jan 5 at 4:44
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
Do you have some reason to believe the normal subsystem configuration isn't working here?
– Kenster
Dec 29 '18 at 19:10
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
);
);
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
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Notice that umask
values only reduce permissions, never adds them.
So if your local file was permission 0644 (-rw-r--r--) then the umask will not add a group write flag. The umask will remove "other write"; so if your local file was 0666 then the remote would be 0664.
If you want to ensure the remote file has group write then you might want the -m 664
flag instead.
Confirmed, thank you. Solved!
– Charles Belov
Jan 5 at 4:44
add a comment |
Notice that umask
values only reduce permissions, never adds them.
So if your local file was permission 0644 (-rw-r--r--) then the umask will not add a group write flag. The umask will remove "other write"; so if your local file was 0666 then the remote would be 0664.
If you want to ensure the remote file has group write then you might want the -m 664
flag instead.
Confirmed, thank you. Solved!
– Charles Belov
Jan 5 at 4:44
add a comment |
Notice that umask
values only reduce permissions, never adds them.
So if your local file was permission 0644 (-rw-r--r--) then the umask will not add a group write flag. The umask will remove "other write"; so if your local file was 0666 then the remote would be 0664.
If you want to ensure the remote file has group write then you might want the -m 664
flag instead.
Notice that umask
values only reduce permissions, never adds them.
So if your local file was permission 0644 (-rw-r--r--) then the umask will not add a group write flag. The umask will remove "other write"; so if your local file was 0666 then the remote would be 0664.
If you want to ensure the remote file has group write then you might want the -m 664
flag instead.
answered Dec 29 '18 at 2:19
Stephen HarrisStephen Harris
25.3k24477
25.3k24477
Confirmed, thank you. Solved!
– Charles Belov
Jan 5 at 4:44
add a comment |
Confirmed, thank you. Solved!
– Charles Belov
Jan 5 at 4:44
Confirmed, thank you. Solved!
– Charles Belov
Jan 5 at 4:44
Confirmed, thank you. Solved!
– Charles Belov
Jan 5 at 4:44
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
Do you have some reason to believe the normal subsystem configuration isn't working here?
– Kenster
Dec 29 '18 at 19:10
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
Do you have some reason to believe the normal subsystem configuration isn't working here?
– Kenster
Dec 29 '18 at 19:10
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
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
answered Dec 29 '18 at 2:03
JohnJohn
1091
1091
Do you have some reason to believe the normal subsystem configuration isn't working here?
– Kenster
Dec 29 '18 at 19:10
add a comment |
Do you have some reason to believe the normal subsystem configuration isn't working here?
– Kenster
Dec 29 '18 at 19:10
Do you have some reason to believe the normal subsystem configuration isn't working here?
– Kenster
Dec 29 '18 at 19:10
Do you have some reason to believe the normal subsystem configuration isn't working here?
– Kenster
Dec 29 '18 at 19:10
add a comment |
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.
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
Are you sure the remote umask is the problem? Your SFTP client may be setting explicit permissions on the remote file.
– Kenster
Dec 29 '18 at 19:09