LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-23-2010, 06:33 AM   #1
maxmil
LQ Newbie
 
Registered: Feb 2006
Posts: 21

Rep: Reputation: 15
Setup permissions for SSH access to apache


I am looking for the best way to set up permissions in the following situation.

I have a web server set up on debian. I have different web sites in /var/www.

Each web has a group of developers who each have system users and ssh access to the server.

For example i have a web site in /var/www/example.com and a group of developers in group exampledev.

I need all the users in exampledev plus the apache user (www-data) to have read write and execute permissions on all the content of the web site.

I can give the group exampledev these permissions without a problem. The problem is that when they modify or create new files (they either connect via ssh o sftp which is the same right?) they are created with their user and group rather than exampledev.

Am i going down the wrong path?

This must be a common situation but i haven't found the solution.

Can someone give me a shove in the right direction.

Thanks.
 
Old 02-23-2010, 07:06 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
If the specific users are in examplegroup, then newgrp examplegroup changes the current group.
http://node1.yo-linux.com/cgi-bin/ma...command=newgrp

But I can't find a way to automatically apply that after login.
Maybe a login script ?


You can use ssh to restrict the groups that can log in using the line

AllowGroups <group-name>

in your sshd_config but it's unclear whether that will disallow users whose default group is their own (user = user, group = user) even though they are also members of examplegroup

You can add more than one group to AllowGroups so it is possible to test things. (Just don't lock yourself out !)

Last edited by smoker; 02-23-2010 at 07:09 AM.
 
Old 02-23-2010, 07:57 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
chmod g+s dirname

enforces ownership of all files created therein to have group owner same as group owner of dir.
 
1 members found this post helpful.
Old 02-24-2010, 05:12 AM   #4
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
Quote:
Originally Posted by chrism01 View Post
chmod g+s dirname

enforces ownership of all files created therein to have group owner same as group owner of dir.
Nice :-)
 
Old 02-24-2010, 08:55 AM   #5
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Also take a look at ACL. They allow you to further extend the normal permission settings.

man setfacl
man getfacl
 
Old 02-26-2010, 08:41 AM   #6
maxmil
LQ Newbie
 
Registered: Feb 2006
Posts: 21

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by chrism01 View Post
chmod g+s dirname

enforces ownership of all files created therein to have group owner same as group owner of dir.
Perfect. I knew that it had to be easy.

Setting up the users umask to give the group write permissions (0002) was not so easy.

There are plenty of ways to do it for ssh but for sftp i didn't find an obvious way.

I presume that pam is the correct way to go but i couldn't get it to work.

In the end i created a wrapper script that sets the users umask before invoking the sftp-server and pointed the Subsystem sftp line to this script in /etc/ssh/sshd_config.

If anyone has an cleaner way of setting up the default sftp umask on debian i would be interested to hear about it.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Permissions: Multiple Users...SSH access... BadCam Linux - Server 1 10-11-2009 12:05 AM
cygwin ssh setup permissions error aloishis89 Linux - Software 7 02-11-2009 10:35 PM
ssh forwarding - how to setup for DB access ? duryodhan Linux - Networking 2 02-19-2008 12:36 PM
Q: backups via SSH with roadblock because of APACHE permissions darkus Linux - Newbie 1 06-14-2007 03:57 PM
Need help configuring permissions to allow FTP access via SSH/SFTP. dhupke Linux - General 5 06-12-2007 12:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration