Solved

Folder Permissions in Linux

Posted on 2008-06-23
3
301 Views
Last Modified: 2013-12-16
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
Comment
Question by:jjmartineziii
3 Comments
 
LVL 14

Accepted Solution

by:
agriesser earned 250 total points
ID: 21847828
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
 
LVL 2

Expert Comment

by:minibago
ID: 21847863

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
 
LVL 12

Author Closing Comment

by:jjmartineziii
ID: 31469822
perfect
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now