开发者

How to set default group permissions for SFTP uploads? [closed]

开发者 https://www.devze.com 2023-01-04 18:07 出处:网络
Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 10 years ago.

Improve this question

I am connecting to a web server running Debian. Our team uses Apache and all users are members of the www-data group. When we connect to this server via SFTP (e.g. Transmit), all of our newly uploaded files take on a group name that is the same as the user's name (i.e. their primary group).

Is there a way to change this default group assignment to www-data on SFTP? On the command line, one can type:

$ newgrp www-data

Which assigns the current user开发者_StackOverflow中文版's primary group to www-data. All new files created by the user are assigned to this group. Is there an equivalent for SFTP?


Setting a directory setgid means that files created within it will acquire the directory's group ownership.

mkdir web
chgrp www-data web
chmod g+s web


You may require the additional step of setting the umask before the server process starts:

umask 0002;
/usr/lib/openssh/sftp-server

Or in sshd_config, "you can pass a flag and value in (-u 0002) like the following to set the umask value:"

Subsystem sftp /usr/lib/openssh/sftp-server -u 0002
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号