I have a quick question. I have a sFTP user who needs to edit/create files within a web directory on my CentOS box. The entire directory is owned by nginx:nginx due to housing multiple websites.<\/p>\n
Advertisement
I added this user to the group that owned the folder and was still unable to own it but when I added the user with the nginx group it worked properly… am I doing something wrong here?<\/p>\n
Advertisement
Current perm for their web directory user:nginx. Is this being done correctly?<\/p>\n
Also - Server does not run an FTP server, all SSH.<\/p>","upvoteCount":4,"answerCount":22,"datePublished":"2015-09-14T13:14:06.000Z","author":{"@type":"Person","name":"mrpeppah","url":"https://community.spiceworks.com/u/mrpeppah"},"acceptedAnswer":{"@type":"Answer","text":"
Things to look at: GUID bit, creation mask.<\/p>\n
These questions will define the final outcome:<\/p>\n
Q) Is nginx requires write permissions to the directory?<\/p>\n
A1) Yes - use GUID bit to ensure ownership on created files and creation mask to make sure that newly created files/dirs have necessary group permissions<\/p>\n
A2) No, set the user as the owner and allow group access (as you did). Update creation mask to create files with at least 640 permission and directories with 750.<\/p>\n
Q) Which user should be the owner?<\/p>\n
A) See above and reverse the ownership if it’s the opposite.<\/p>\n
Q) What’s the better way to implement this?<\/p>\n
A) Give the minimum necessary permissions to the users or processes for them to function correctly, both are covered by the previous questions/answers.<\/p>\n
Ultimately you want to go with minimalistic approach, and that means nginx user should be the owner, “user” should be part of the nginx group and files directories that require user access should have group permission set on them to allow writing “g+w”, yet any files created should have nginx as owner, thus the GUID bit.<\/p>","upvoteCount":0,"datePublished":"2015-09-15T15:13:11.000Z","url":"https://community.spiceworks.com/t/permissions-permissions/435321/22","author":{"@type":"Person","name":"borisbondarenko7268","url":"https://community.spiceworks.com/u/borisbondarenko7268"}},"suggestedAnswer":[{"@type":"Answer","text":"
I have a quick question. I have a sFTP user who needs to edit/create files within a web directory on my CentOS box. The entire directory is owned by nginx:nginx due to housing multiple websites.<\/p>\n
I added this user to the group that owned the folder and was still unable to own it but when I added the user with the nginx group it worked properly… am I doing something wrong here?<\/p>\n
Current perm for their web directory user:nginx. Is this being done correctly?<\/p>\n
Also - Server does not run an FTP server, all SSH.<\/p>","upvoteCount":4,"datePublished":"2015-09-14T13:14:06.000Z","url":"https://community.spiceworks.com/t/permissions-permissions/435321/1","author":{"@type":"Person","name":"mrpeppah","url":"https://community.spiceworks.com/u/mrpeppah"}},{"@type":"Answer","text":"
So you’ve got a user that has SSH<\/strong> access (not sftp)<\/em> to your web server in order to update files that exist in a directory owned by the nginx user and group. In order to allow the user read/write access to this directory you’ve added said user to the nginx group.<\/p>\n
Unless a more seasoned admin has a reason for doing this another way, I think that should work just fine. Just make sure that user does not have root access and your SSH server is properly secured(sshd config, Fail2ban, etc…).<\/p>","upvoteCount":1,"datePublished":"2015-09-14T13:29:00.000Z","url":"https://community.spiceworks.com/t/permissions-permissions/435321/2","author":{"@type":"Person","name":"will224","url":"https://community.spiceworks.com/u/will224"}},{"@type":"Answer","text":"
You might also review Unix/Linux permissions if you are a little confused on how things work.<\/p>\n