H
H
Harlan2020-06-03 12:36:53
SSH
Harlan, 2020-06-03 12:36:53

How to set permissions for files sent via sftp?

To exchange files between two users raised SFTP. The /etc/ssh/sshd_config file looks like this:

Subsystem       sftp    internal-sftp
Match group sftp
        X11Forwarding no
        PasswordAuthentication no
        AuthorizedKeysFile %h/.ssh/authorized_keys
        AllowTcpForwarding no
        AllowAgentForwarding no
        PermitTunnel no
        PermitTTY no
        ForceCommand internal-sftp
        ChrootDirectory /var/change

Created two users user1 and user2 who are members of the sftp group
Created the /var/change directory root:root Permissions 755
Created the /var/change/Doc directory root:sftp Permissions 770
Both users connect normally, see the /var/change/Doc folder and can write in it. But they can only read what they wrote down themselves. Since all files being written are assigned rights 600 and the owner is the user who wrote it (i.e. if user1 wrote, then the owner is user1:user1, and for user2, respectively, user2:user2).

Is it possible to make sure that each user can read / write / delete files and another user? Those. the owner of the file was writer:sftp (where writer is the creator of the file), and the permissions were set to 660?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question