Automate setting of group permissions


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Automate setting of group permissions
# 1  
Old 04-19-2011
Automate setting of group permissions

What would be a practical way of making sure files I upload to/edit in a particular directory on a server always have the correct group permissions?

I'm forgetful, so I try to automate things like chgrp'ing the files when I'm done. I could write a script to be run by cron. Is that the only way, or are there any options/variables I can use with ssh and scp so that files created by my user automatically have the right group and permissions?

Note: Files should belong to a certain group if they are located in a certain directory, but elsewhere on the server, they should belong to my primary group.

(The story: This is a web server on which I have my personal homepage and on which there are also areas which need to be editable by the whole department. The admins have created a group for that, www-ourdept. How do I avoid forgetting to chgrp/chown the stuff after I'm done? Apart from using a post-it as reminder on the monitor of my PC, of course.)
# 2  
Old 04-19-2011
Does that certain directory belong to the group? Setting the SETGID bit on that directory would cause every file created there to belong to that group.
Code:
chmod g+s /your/directory

This User Gave Thanks to cero For This Post:
# 3  
Old 04-19-2011
It seems the admins have done that for me. I didn't realize that when I posted.

What remains is the problem of making everything in the directory group-writable automatically. I seem to remember that that's what I kept on forgetting when editing group web pages in the past (I just haven't done it in a while).

Is there a way to set the umask for a particular directory or something? Maybe along the lines of:
Code:
if expr $PWD : <directory> >/dev/null
then
    umask u=rw,g=rw,o=
fi

But how do I get that excecuted every time I log on to work on group web pages, but not when I log on to work on my personal web page? .bashrc won't work... It would have to be read after I cd to the directory :-/
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Group permissions question

I have a user who has had an id change. His old id was xl00 his new id b000999. Both id's are in group bauser. The user now cannot access his old files even though he is in the same group and permissions seem to be ok. See below, first 2 files he can't see, second two are no problem. ... (2 Replies)
Discussion started by: dw82199
2 Replies

2. UNIX for Advanced & Expert Users

Can we Automate the User creation and setting password through a script in solaris 10

Hi, I am using Solaris 10 OS and Bash shell.Is there any way can we automate User creation and setting passwords through a script or any freeware tool. Advance thanks for your response. (1 Reply)
Discussion started by: muraliinfy04
1 Replies

3. UNIX for Dummies Questions & Answers

Root group permissions

Hi everybody, which are the root group permissions and how can I give to a user these rights? Thanks in advance. (2 Replies)
Discussion started by: bmayao
2 Replies

4. Solaris

Group Permissions - How to tell the difference

I am a member of a few different user groups. I would like to see what the difference is.... Can anyone tell me how to look at permissions side by side ? We are using : SunOS xxxxxx 5.10 Generic_127111-09 sun4u sparc SUNW,Sun-Fire-V440 Thanks ! (10 Replies)
Discussion started by: popeye
10 Replies

5. UNIX for Dummies Questions & Answers

Group permissions

Hi, I've created a user named fwadmin, group named fwadmin and made the user belong to that group. I created the user and group using the 'User Manager' in Centos. The user belongs to /etc/fw.Does this also mean that the group fwadmin belongs to /etc/fw. That is what I want. But when I... (4 Replies)
Discussion started by: anaigini45
4 Replies

6. AIX

bin group strange permissions

I was doing a little playing around with permissions on a 5.3 box in the office and wanted to make it so that it does not take root permission to delete a users home directory once they are deactivated or deleted in smit. the default permissions are 755 with bin as both user and group I noticed... (2 Replies)
Discussion started by: dgaixsysadm
2 Replies

7. UNIX for Dummies Questions & Answers

Setting permissions

I've been told I need to set the permissions for everything in the htdocs folder to 777, but how do I go about doing this? Thanks:o (9 Replies)
Discussion started by: thehaapyappy
9 Replies

8. UNIX for Dummies Questions & Answers

Help setting up file permissions

Hi, I'm in the process of writing a system (in Java) where a user can register to become a member of a website. When they register, a collection of directories and files get created by the application. For example if a user with the name 'fred' registered they would get the following drwxr-xr-x... (0 Replies)
Discussion started by: andrewpmoore
0 Replies

9. Filesystems, Disks and Memory

group permissions/webserver

Hi, there is one strange situation with directory permissions that I run into every now and then, and now I face it a gain with a webserver. Situation (example): drwxrwsr-x 14 user www-data 4096 Jul 28 11:06 . drwxr-xr-x 2 www-data www-data 4096 Jul 28 11:06 subdir -rwxr-xr-x 1... (3 Replies)
Discussion started by: doozer
3 Replies

10. UNIX for Dummies Questions & Answers

root group permissions

Hello, Another newbie here and here is my dilemma. I created an account for me on Solaris 8 and I added myself to the root group. But when I login using that account I am unable to do superuser tasks.. (add users, admintool, etc). What am I missing? Thanks in advance.. Andre (5 Replies)
Discussion started by: jacobsa
5 Replies
Login or Register to Ask a Question