Re: permissions and the /etc/skel directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On January 5, 2004 12:46 pm, Chris W. Parker wrote:
> Pete Nesbitt <mailto:pete@xxxxxxxxx>
>
>     on Saturday, January 03, 2004 1:26 PM said:
> > useradd always sets ownership to the new dirs & files to the new user.
> >
> > It sounds like you may want to look at sgid to set the default  group
> > ownership so group members can all access all files. You should man
> > chmod & look for sgid for more info.
>
> uh oh. that sounds a little too complicated for me... how about this? i
> create a script to automagically do this for me?
>
> i've never written a shell script but i imagine it would do the
> following:
>
> 1. accept one piece of information: username
> 2. perform the following commands:
>
> # useradd $username
> # cd /home/$username
> # chown .apache . www/
> # chmod 770 . www/
> # passwd $username <some_default_password>
>
> 3. exit
>
> this way i can create the new user AND have the correct permissions.
> this should work right?
>
>
>
> chris.

Well, yes, but do you really want the group apache to have write permission to 
all your new users home directories? 
Also, you'll need to add --stdin to the passwd line:
passwd --stdin $username  <  some_TEXT-FILE

Also, if that is the case, any files the user makes in www will be owned by 
the user's group, not apache.
If you do want apache to have those permissions, but also to own future 
created files in www, just add a line to your script:
chmod g+s www  (while in the users home)
That will set the SGID as mentioned.

What are you trying to do anyway, just make web areas for your users? If so 
you may want to consider creating the www dir in the documentroot of apache 
and allowing the users access via a symlink.
ln -s /var/www/html/$username /home/$username/www

Hope that helps.
-- 
Pete Nesbitt, rhce


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux