How to add user in a group?
Hi,
I have four users in my red hat linux 9. I want that all these four users should add in a group i.e "Marketing".please guide me that using terminal which command may i write so that the users should added in the group. Note:- I does't want to use GUI interface to do it. thanks in advance, garden |
Try this:
Quote:
|
Code:
for user in john bill mary jane |
thanks for the prompt reply. Well the command works fine. Now a question rises that how can I see all four users in "Marketing " Group. Is there anyway command to check it ?
|
Quote:
Quote:
|
You may want to use
Code:
egrep '^Marketing:' /etc/group -- Dan |
thanks a lot all of you for guiding me. Well about users and groups in linux and the files related to it, kindly refer me any site in which I may study it in more detail.
Again thanks garden |
well the command
#cat /etc/group| grep Martketing and egrep '^Marketing:' /etc/group provide same output.So what is the difference in both these and in which situation I may use egrep or cat command. Iam sure there should be a minor difference. |
Man pages will tell you.
Code:
man grep |
Basically grep and egrep is same command, look into the man page for more information.
#man grep |
Quote:
Your example would match more than "Marketing" (e.g. "Marketing2"), that could cause problems when used in scripts. |
Nothing like allowing the OP to answer his/her own question, eh? Your answer isn't quite right either.
from the man page: Quote:
|
Quote:
Yes, you're right. Let's get it entirely right: Code:
/bin/grep '^Marketing:' /usr/group |
If you're really using red hat linux 9 (codename Shrike) http://en.wikipedia.org/wiki/Red_Hat_Linux, it hasn't been updated, inc security in years. Do yourself (& us ) a favour an get something current eg http://en.wikipedia.org/wiki/CentOS
|
Quote:
|
All times are GMT -5. The time now is 09:35 AM. |