C2k Help
Operating Systems => MAC OS => Topic started by: Stephen on January 30, 2013, 11:01:33 AM
-
I need to get rid of a couple of years of users off my xserve. So I went to the user home directory (basically the cd command so to move to a raid called raiddrive and the subfolder user_homes the command is cd /volumes/raiddrive/user_homes) in terminal and did
ls -l >usermac.txt
This gave me a directory listing of all user home folders. I took this file and copied and pasted into excel.
Using =right(A2,Len(A2)-91) where A2 is the first line in the directory listing gave me the short username for that user. This I copied down to the end of the userlist.
As I used c2k usernames for the short name I used web provisioning to generate a full c2k user list.
I then compared the mac user list to the c2k user list to find which users needed deleting, remeber to check for visiting students etc.
Is there anyway to batch delete the users from the workgroup manager by just knowing their user shortnames?
I was thinking of moving the user home folder from home to deletedusers folder and then backing the deleted users up before deletion.
You can do this a user at a time using sudo mv username /volumes/raiddrive/deletedusers/username
How would I do this for multiple users as I dont want to use sudo for every user.
Update:
Ok for moving a users home folder I am now trying
echo "password" ? sudo -S mv /volumes/raiddrive/user_homes/username123 /volumes/raiddrive/deletedusers/username123
sudo -S accepts the previously echoed password then it is a case of moving the users folder to where I am going to back it up. Then using excel and concatenate to do this for all the users I will be deleteing, quick copy and paste into a text file. Now just getting the mac to run it. I am going to try two different methods and lets you know how it goes.
Easy peasy:- took the list saved it as a text file and copied it into my user home folder. changed the file extension to .sh from .txt
Used the command chmod +x filename.sh where filename.sh is my file of "batch" commands
then cant remember wether I used ./filename.sh to run the file or run"./filename.sh" but ran it and all the user folders have been moved to the deletedusers folder.
So just the backup of Deleted users before actually deleting and then it is down to how do you bulk delete the users from workgroup manager.
-
Good luck! Going to need to do this next year so I might be using this later.
-
The thing is si to make a distinction in a field to make the lookup easier.
e.g. have a field in the user account that is basically in2007 etc, would make the delete from Workgroup manager easier - I think.
-
I have my pupils all assigned to a year so it should be easy to delete all with the year 14 group applying to them then?
-
By the way, the server app probably works differently - you can select users the same way as you can files with it. select year group, Shift click the list of names and choose 'delete user' . I think anyway...
-
My original list of users was put in as one clump with nothing to differentiate between them.
By the way make sure you dont move admin accounts when you move old users out as your admin usernames will not be part of the c2k list.