RE: [suse-linux-uk-schools] addins users to groups....... 500+
<andrew.nix@st-paulshigh.manchester.sch.uk> wrote: > I
need to add 500+ user to a group. Does anyone know how I can this
without adding each person individually? As I think I might be sat in this seat for the next two weeks adding everyone and miss my holiday to Ibiza! Cheers
You can do something like this:
for i in $(cat /etc/passwd | awk -F: '{print $1}'); do chown $i.GROUPNAME; done
Actually, you don't do that! It won't work....
for i in $(cat /etc/passwd | awk -F: '{print $1}'); do adduser $i GROUPNAME; done
Will that add everyone in /etc/passwd? If so there are profiles in
I believe you can just modify the spreadsheet and use the newusers command again - it can update bulk users as well as create them. Have a look at "man newusers" and "man 5 passwd" for details. -----Original Message----- From: Thomas Adam To: Andrew Nix; suse-linux-uk-schools@suse.com Sent: 8/1/03 12:00 PM Subject: Re: [suse-linux-uk-schools] addins users to groups....... 500+ --- Andrew Nix <andrew.nix@st-paulshigh.manchester.sch.uk> wrote: > > --- Thomas Adam <thomas_adam16@yahoo.com> wrote: > --- Andrew Nix there
that dont need to be added to the group. I should have said this earlier.
I am fully aware of that, and it was a very quick hack.
I have a spreadsheet that was used to create all the profile and I want. I used a commmand something like:
addnewuser <filename of spreadsheet>
and it created them all for me! Can something similar be done with groups?
Assuming that you have the list of users, export it to a cvs (a comma separated file) and issue the command: for i in $(cat ./the_file | awk -F, '{print $NUM}'); do useradd $NUM -G groupname; done You'll have to change the above so that $NUM is the column number that the username appears in (i.e. $1, $2, etc) and change "groupname" as appropriate. HTH, -- Thomas Adam
The above will work!!!
Sorry, Andrew,
-- Thomas Adam
===== Thomas Adam
"The Linux Weekend Mechanic" -- www.linuxgazette.com
________________________________________________________________________
Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://uk.messenger.yahoo.com/
-- To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@suse.com For additional commands, e-mail: suse-linux-uk-schools-help@suse.com
-- To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@suse.com For additional commands, e-mail: suse-linux-uk-schools-help@suse.com
===== Thomas Adam "The Linux Weekend Mechanic" -- www.linuxgazette.com ________________________________________________________________________ Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://uk.messenger.yahoo.com/ -- To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@suse.com For additional commands, e-mail: suse-linux-uk-schools-help@suse.com
--- Chris Puttick <chris@centralmanclc.com> wrote: > I believe you can just modify the spreadsheet and use the newusers
command again - it can update bulk users as well as create them. Have a look at "man newusers" and "man 5 passwd" for details.
I wasn't aware of that :) Mind you, I always like the generic approach, Chris, and it should work.... -- Thomas Adam
-----Original Message----- From: Thomas Adam To: Andrew Nix; suse-linux-uk-schools@suse.com Sent: 8/1/03 12:00 PM Subject: Re: [suse-linux-uk-schools] addins users to groups....... 500+
<andrew.nix@st-paulshigh.manchester.sch.uk> wrote: > I
need to add 500+ user to a group. Does anyone know how I can this
without adding each person individually? As I think I might be sat in this seat for the next two weeks adding everyone and miss my holiday to Ibiza! Cheers
You can do something like this:
for i in $(cat /etc/passwd | awk -F: '{print $1}'); do chown $i.GROUPNAME; done
Actually, you don't do that! It won't work....
for i in $(cat /etc/passwd | awk -F: '{print $1}'); do adduser $i GROUPNAME; done
Will that add everyone in /etc/passwd? If so there are profiles in
--- Andrew Nix <andrew.nix@st-paulshigh.manchester.sch.uk> wrote: > > --- Thomas Adam <thomas_adam16@yahoo.com> wrote: > --- Andrew Nix there
that dont need to be added to the group. I should have said this earlier.
I am fully aware of that, and it was a very quick hack.
I have a spreadsheet that was used to create all the profile and I want. I used a commmand something like:
addnewuser <filename of spreadsheet>
and it created them all for me! Can something similar be done with groups?
Assuming that you have the list of users, export it to a cvs (a comma separated file) and issue the command:
for i in $(cat ./the_file | awk -F, '{print $NUM}'); do useradd $NUM -G groupname; done
You'll have to change the above so that $NUM is the column number that the username appears in (i.e. $1, $2, etc) and change "groupname" as appropriate.
HTH,
-- Thomas Adam
The above will work!!!
Sorry, Andrew,
-- Thomas Adam
===== Thomas Adam
"The Linux Weekend Mechanic" -- www.linuxgazette.com
________________________________________________________________________
Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://uk.messenger.yahoo.com/
-- To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@suse.com For additional commands, e-mail: suse-linux-uk-schools-help@suse.com
-- To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@suse.com For additional commands, e-mail: suse-linux-uk-schools-help@suse.com
===== Thomas Adam
"The Linux Weekend Mechanic" -- www.linuxgazette.com
________________________________________________________________________ Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://uk.messenger.yahoo.com/
-- To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@suse.com For additional commands, e-mail: suse-linux-uk-schools-help@suse.com
-- To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@suse.com For additional commands, e-mail: suse-linux-uk-schools-help@suse.com
===== Thomas Adam "The Linux Weekend Mechanic" -- www.linuxgazette.com ________________________________________________________________________ Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://uk.messenger.yahoo.com/
--- Chris Puttick <chris@centralmanclc.com> wrote: > I believe you can just modify the spreadsheet and use the newusers
command again - it can update bulk users as well as create them. Have a look at "man newusers" and "man 5 passwd" for details.
I had a look at the help for these two things chris but as I have no idea what so ever as the thier function. It makes using them a little difficult! An example would be really helpful!
Assuming that you have the list of users, export it to a cvs (a comma separated file) and issue the command:
How do I export my spreadsheet to a cvs file? And, what is a cvs file?
for i in $(cat ./the_file | awk -F, '{print $NUM}'); do useradd $NUM -G groupname; done
You'll have to change the above so that $NUM is the column number that the username appears in (i.e. $1, $2, etc) and change "groupname" as appropriate.
-- Andrew Nix St Pauls Catholic High School Firbank Road Newall Green Wythenshawe Manchester M23 2YS tel: 0161 4375841 ext 168 fax: 0161 4982030
--- Andrew Nix <andrew.nix@st-paulshigh.manchester.sch.uk> wrote: > > --- Chris Puttick <chris@centralmanclc.com> wrote: > I believe you
can
just modify the spreadsheet and use the newusers
command again - it can update bulk users as well as create them. Have a look at "man newusers" and "man 5 passwd" for details.
I had a look at the help for these two things chris but as I have no idea what so ever as the thier function. It makes using them a little difficult! An example would be really helpful!
Assuming that you have the list of users, export it to a cvs (a comma separated file) and issue the command:
How do I export my spreadsheet to a cvs file? And, what is a cvs file?
Well, assuming it is Office2000, etc, just click "save as" then select the filetype as cvs.... Alternativelty, you dont need to export it if you can manually extract all the usernames and save them to a separate plain text file.
for i in $(cat ./the_file | awk -F, '{print $NUM}'); do useradd $NUM -G groupname; done
Then the above script will still apply
You'll have to change the above so that $NUM is the column number that the username appears in (i.e. $1, $2, etc) and change "groupname" as appropriate.
-- Andrew Nix
St Pauls Catholic High School Firbank Road Newall Green Wythenshawe Manchester M23 2YS tel: 0161 4375841 ext 168 fax: 0161 4982030
-- To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@suse.com For additional commands, e-mail: suse-linux-uk-schools-help@suse.com
===== Thomas Adam "The Linux Weekend Mechanic" -- www.linuxgazette.com ________________________________________________________________________ Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://uk.messenger.yahoo.com/
--- Andrew Nix <andrew.nix@st-paulshigh.manchester.sch.uk> wrote: > > --- Chris Puttick <chris@centralmanclc.com> wrote: > I believe you
can
just modify the spreadsheet and use the newusers
command again - it can update bulk users as well as create them. Have a look at "man newusers" and "man 5 passwd" for details.
I had a look at the help for these two things chris but as I have no idea what so ever as the thier function. It makes using them a little difficult! An example would be really helpful!
Assuming that you have the list of users, export it to a cvs (a comma separated file) and issue the command:
How do I export my spreadsheet to a cvs file? And, what is a cvs file?
Well, assuming it is Office2000 (I stay away from M$ products), etc, just
click "save as" then select the filetype as cvs....
I use OOo 1.1beta2. I had a look in the save as options and it said nothing about cvs files. I ask again what is a cvs file?
Alternativelty, you dont need to export it if you can manually extract all the usernames and save them to a separate plain text file.
for i in $(cat ./the_file | awk -F, '{print $NUM}'); do useradd $NUM -G groupname; done
Then the above script will still apply
Saving it in a text file willwont make it a cvs file tho will it? Does that mean that it doesnt acctually have to be in a cvs file at all?
You'll have to change the above so that $NUM is the column number that the username appears in (i.e. $1, $2, etc) and change "groupname" as appropriate.
-- Andrew Nix
St Pauls Catholic High School Firbank Road Newall Green Wythenshawe Manchester M23 2YS tel: 0161 4375841 ext 168 fax: 0161 4982030
--- Andrew Nix <andrew.nix@st-paulshigh.manchester.sch.uk> wrote: > > --- Andrew Nix <andrew.nix@st-paulshigh.manchester.sch.uk> wrote: > >
--- Chris Puttick <chris@centralmanclc.com> wrote: > I believe you
can
just modify the spreadsheet and use the newusers
command again - it can update bulk users as well as create them. Have a look at "man newusers" and "man 5 passwd" for details.
I had a look at the help for these two things chris but as I have no idea what so ever as the thier function. It makes using them a little difficult! An example would be really helpful!
Assuming that you have the list of users, export it to a cvs (a comma separated file) and issue the command:
How do I export my spreadsheet to a cvs file? And, what is a cvs file?
Well, assuming it is Office2000 (I stay away from M$ products), etc, just
click "save as" then select the filetype as cvs....
I use OOo 1.1beta2. I had a look in the save as options and it said nothing about cvs files. I ask again what is a cvs file?
Sorru, I thought I had explained :( a cvs file is a comma separated list of all your columns in your spreadsheet, i.e. say you had a spreadsheet like this: 1 2 3 a zz zz aa b qw gh xz c vf tg jk then your cvs file would look like: zz,zz,aa qw,gh,xz vf,tg,jk
Alternativelty, you dont need to export it if you can manually extract all the usernames and save them to a separate plain text file.
for i in $(cat ./the_file | awk -F, '{print $NUM}'); do useradd $NUM -G groupname; done
Then the above script will still apply
Saving it in a text file willwont make it a cvs file tho will it? Does that mean that it doesnt acctually have to be in a cvs file at all?
yes, as long as the usernames are listed one after the other in the file like this: user1 user2 user3 etc... -- Thomas Adam
You'll have to change the above so that $NUM is the column number that the username appears in (i.e. $1, $2, etc) and change "groupname" as appropriate.
-- Andrew Nix
St Pauls Catholic High School Firbank Road Newall Green Wythenshawe Manchester M23 2YS tel: 0161 4375841 ext 168 fax: 0161 4982030
-- To unsubscribe, e-mail: suse-linux-uk-schools-unsubscribe@suse.com For additional commands, e-mail: suse-linux-uk-schools-help@suse.com
===== Thomas Adam "The Linux Weekend Mechanic" -- www.linuxgazette.com ________________________________________________________________________ Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://uk.messenger.yahoo.com/
Hi I think you mean csv as in comma separated values and not cvs. Incidentally I am in my annual 'update the server' routine and I use speadsheets to generate multiple bash commands to add my 1500 users, set quotas etc along with expect to automatically add passwords. This is not as elegant as Thomas's routines but it has worked for the last 4 years. Dave
--- David Williams <david@williams333.freeserve.co.uk> wrote: > Hi Dave,
I think you mean csv as in comma separated values and not cvs.
Yes, you're quite right. That's one of my more classic freudian slips :)
Incidentally I am in my annual 'update the server' routine and I use speadsheets to generate multiple bash commands to add my 1500 users, set quotas etc along with expect to automatically add passwords.
Yes, not a bad idea there, but you have to be careful about security, especially if you leave the spreadsheet non-encryped. I use expect all the time too, for automated tasks that require user interaction of some kind.
This is not as elegant as Thomas's routines but it has worked for the last 4 years.
Granted my routine was off the top of my head, but I am sure that it will work, nevertheless. -- Thomas Adam ===== Thomas Adam "The Linux Weekend Mechanic" -- www.linuxgazette.com ________________________________________________________________________ Want to chat instantly with your online friends? Get the FREE Yahoo! Messenger http://uk.messenger.yahoo.com/
participants (4)
-
Andrew Nix
-
Chris Puttick
-
David Williams
-
Thomas Adam