I am using CentOS 5.5 with OpenSSH 5.7 and am running into a permission issue with SFTP. I have both employees accessing the server from the internal network as well as customers accessing the server from the Internet.
All of the customers are in a group call sftpusers and are chrooted to a directory, using the internal-sftp subsystem of OpenSSH 5.7 for that group.
Inside this directory there are individual directories for each user to upload their files. The directories are setup with the customer's userid as the owner with RW permissions, and a group with RW permissions.
The customer is not in the group that has RWX permissions to the directory. All of our employees are in that group so they can retrieve the files the customers upload to the server.
When the customer uploads a file to the server, the system is defaulting the permissions to 644. How do I get it so the permissions default to 660?
The second question is that when one of our employees places something in the customer's directory via SSH the server assigns it the userid and the primary group of the uploader? How do we get the system to use the parent directories owner and group instead of the uploaders? There are times when we need to place something in the customer's directory for them to retrieve.
The end result is that each customer has their own private directory that other customers can't access but our employees can. Both employees and customers should be able to create, delete, and modify the contents of the individual directories.
I have tried setting the setUID (chmod -R u+s /path to customer directory/customer directory) and setGID (chmod -R g+s /path to customer directory/customer directory) bits but it is not doing what I expect them to do.