开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜