datadan
06-27-2001, 09:56 PM
This may seem inane, but I can't seem to figure out how to setup a group that distributes mail to several users without manually editing the /etc/aliases or .forward file every single time I want to add or subtract a user.
I tried two approaches.
1) Method one was to setup adduser -G group user. If I type
grep "^group" /etc/group | cut -f4 -d":" | tr "," " "
at the command line I get a list of all users in group. Therefore I thought I could add to /etc/aliases
mailgroup: sj:/usr/sbin/grep "^sj" /etc/group | /usr/bin/cut -f4 -d":" | /usr/bin/tr "," " "
however this doesn't work. I get a:
Can't create output: No such file or directory
error
2) I get the same errors if I adduser mailgroup and put in the .forward file of the /home/$user directory the same arguments.
I really don't want to have to vi edit the aliases file for every useradd/del/change. Its double work and if I forget, things get will get screwy.
Thank you for your help.
I tried two approaches.
1) Method one was to setup adduser -G group user. If I type
grep "^group" /etc/group | cut -f4 -d":" | tr "," " "
at the command line I get a list of all users in group. Therefore I thought I could add to /etc/aliases
mailgroup: sj:/usr/sbin/grep "^sj" /etc/group | /usr/bin/cut -f4 -d":" | /usr/bin/tr "," " "
however this doesn't work. I get a:
Can't create output: No such file or directory
error
2) I get the same errors if I adduser mailgroup and put in the .forward file of the /home/$user directory the same arguments.
I really don't want to have to vi edit the aliases file for every useradd/del/change. Its double work and if I forget, things get will get screwy.
Thank you for your help.