Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 320
  • Last Modified:

Folder Permissions in Linux

I'm setting up an sftp and want one folder where people can add and remove files.

I want the group "sftp" to have read and write access to /home/sftp (this is not a home folder, just located there).

How can I do this so that any new files as well (uploaded by either user) can be rw to both users?
0
jjmartineziii
Asked:
jjmartineziii
1 Solution
 
agriesserCommented:
The group sftp needs to own this directory. That can be achieved by running:

chgrp sftp /home/sftp

And now you need to tell the filesystem that all files created in this directory will inherit its permissions from the directory itself. Therefore you need to set the setgid bit for that directory (therefore, all files will be created with the group set to sftp):

chmod 2775 /home/sftp

Now you need to set the umask for these two users to 002 instead of the default 022, that way all new files created will have rw-rw-r-- permissions (owner and group writable) and all new directories will have rwxrwxr-x.
0
 
minibagoCommented:

If your users are members of the group 'sftp' and it's the 'sftp' group that is putting the files in that folder then setting the group for that folder to 'sftp' like so (in a terminal):

chgrp -R sftp /home/sftp

Then give the group read and write access like so:

chmod g+r /home/sftp
chmod g+w /home/sftp


I hope that helps.

=)
0
 
jjmartineziiiAuthor Commented:
perfect
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now