Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

OSX server question - removing data....

Thread Tools
 
Search this Thread
 
Old 27 June 2012, 10:02 AM
  #1  
ScoobyDoo555
Scooby Regular
Thread Starter
 
ScoobyDoo555's Avatar
 
Join Date: Oct 2000
Location: Does it matter?
Posts: 11,217
Likes: 0
Received 0 Likes on 0 Posts
Question OSX server question - removing data....

from authenticated users' desktops....

How do you do it?



To cut a long story short, my students are now done for the year, and I want to flush their desktops/local machines.
I would rather not flush completely with a new disk image tbh, as the machines are fine.

We use OSX server to authenticate to desktop (with no admin-rights for the users!)

Just trying to work out how to delete their locally stored data (that they should have deleted!)


Any ideas?

Dan
Old 27 June 2012, 05:26 PM
  #2  
Markus
Scooby Regular
 
Markus's Avatar
 
Join Date: Mar 1999
Location: The Great White North
Posts: 25,080
Likes: 0
Received 0 Likes on 0 Posts
Default

Ah, if we were a few years ago I'd have told you to buy and install MacAdministrator

What exactly do you want to preserve? I'm guessing you'd want to do something to "/Users/<username>/Desktop/" at the very least, if not "/Users/<username>/Documents/"

The preserve thing comes into play as you may want to keep stuff in /Users/<username>/Library/ or other folders.

Do you have ARD? That might have options for this stuff built in, if not, it allows you to run a script, so you could have a shell script that iterates through /Users/ and trashes the contents of the Documents, Desktop, Music, and Pictures folders.
Old 27 June 2012, 07:58 PM
  #3  
ScoobyDoo555
Scooby Regular
Thread Starter
 
ScoobyDoo555's Avatar
 
Join Date: Oct 2000
Location: Does it matter?
Posts: 11,217
Likes: 0
Received 0 Likes on 0 Posts
Default

What exactly do you want to preserve? I'm guessing you'd want to do something to "/Users/<username>/Desktop/" at the very least, if not "/Users/<username>/Documents/"

The preserve thing comes into play as you may want to keep stuff in /Users/<username>/Library/ or other folders.

Do you have ARD? That might have options for this stuff built in, if not, it allows you to run a script, so you could have a shell script that iterates through /Users/ and trashes the contents of the Documents, Desktop, Music, and Pictures folders.
I thought you might reply

How's things going buddy?


All I want to preserve is the usernames for the one group, AND delete the users and associated user files for the other group.

Basically the students "dump" all their work onto the desktop, so I want to wipe their desktops, itunes libraries, documents, videos, images etc - ie their home folder.

I'm still running ARD 3.0 so I do have access to the machines.

Dan
Old 28 June 2012, 12:34 AM
  #4  
Markus
Scooby Regular
 
Markus's Avatar
 
Join Date: Mar 1999
Location: The Great White North
Posts: 25,080
Likes: 0
Received 0 Likes on 0 Posts
Default

I'm doing well, hope the same is true for you.

Ok, the home folder deletion is pretty easy. The users, hmm, probably a dscl command to delete a user. Have a look at this which details how to use dscl to delete users.

You could then knock up a script script to trash the users you don't want.
Old 28 June 2012, 07:25 AM
  #5  
ScoobyDoo555
Scooby Regular
Thread Starter
 
ScoobyDoo555's Avatar
 
Join Date: Oct 2000
Location: Does it matter?
Posts: 11,217
Likes: 0
Received 0 Likes on 0 Posts
Default

Thanks mate - yeh, all good here too

I'm pretty sure I've got the user-deletion covered: just do it from the Workgroup user manager in Server.
It's just getting rid of the home folders.......

Dan
Old 29 June 2012, 03:13 AM
  #6  
Markus
Scooby Regular
 
Markus's Avatar
 
Join Date: Mar 1999
Location: The Great White North
Posts: 25,080
Likes: 0
Received 0 Likes on 0 Posts
Default

Originally Posted by ScoobyDoo555
Thanks mate - yeh, all good here too

I'm pretty sure I've got the user-deletion covered: just do it from the Workgroup user manager in Server.
It's just getting rid of the home folders.......

Dan
Doh, was going to ask if you had the user accounts in the server

As for the home folders. Ok, this should work:

Code:
-- List of user folders to keep
set listofuserstopreserve to {".localized", ""}

-- Path to the Users folder
set pathtousersfolder to "/Users/"

-- List all folders in /Users/
set listoffoldersinusersfolders to list folder (POSIX file pathtousersfolder)

-- Iterate through the list of folders in /Users and delete those that are not on the preservation list
repeat with auserfolder in listoffoldersinusersfolders
	
	-- Check to see if the item is in the protected list
	if listofuserstopreserve does not contain auserfolder then
		-- Kill the folder
		set shellcode to ("sudo rm -rf '/Users/" & auserfolder & "'") as string
		do shell script shellcode user name "<TheAdminName>" password "<TheAdminPassword>" with administrator privileges
	end if
end repeat
That's applescript, so fire up applescript editor, paste it in. Edit the list at the top (keep the .localized item) so you'd have ".localized, "user one","user two" and so on, these are users you do NOT want to delete. It MUST be the short name of the user as defined by the OS

Other step is to look for <TheAdminName> and <TheAdminPassword> items change those to a local admin username (short name) and password.

Copy the script over using ARD, and then run it using ARD. I'd run it on a machine first to make sure it works and if so, deploy it to all machines and run it on all of them.
Old 29 June 2012, 02:55 PM
  #7  
ScoobyDoo555
Scooby Regular
Thread Starter
 
ScoobyDoo555's Avatar
 
Join Date: Oct 2000
Location: Does it matter?
Posts: 11,217
Likes: 0
Received 0 Likes on 0 Posts
Default

Thanks Markus, this seems to be doing part of the job - we're also looking at a total flush (seems like a good time to be looking at it tbh! )

Dan

Trending Topics

Old 29 June 2012, 08:51 PM
  #8  
Markus
Scooby Regular
 
Markus's Avatar
 
Join Date: Mar 1999
Location: The Great White North
Posts: 25,080
Likes: 0
Received 0 Likes on 0 Posts
Default

If you are thinking of a re-image, then check this out: http://code.google.com/p/instadmg/
Very cool, basically it's like an windows slipstream, but for OS X. Very handy when you need to get a machine to the latest OS and don't have an install dvd of that os.

File can then be used with Apple's net restore stuff to push it out to many machines.
Old 30 June 2012, 08:04 AM
  #9  
ScoobyDoo555
Scooby Regular
Thread Starter
 
ScoobyDoo555's Avatar
 
Join Date: Oct 2000
Location: Does it matter?
Posts: 11,217
Likes: 0
Received 0 Likes on 0 Posts
Default

Thanks for that Markus - will have a look into it. Got t flush 22 macs in the next week. Along with everything else!!
This may make light work of it.

Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
just me
Non Scooby Related
26
03 January 2020 11:12 AM
Pro-Line Motorsport
Car Parts For Sale
48
21 July 2017 09:50 PM
Manford
Lighting and Other Electrical
5
02 October 2015 07:51 PM
buckerz69
Subaru Parts
0
29 September 2015 04:16 PM
S600HBY
Subaru Parts
0
25 September 2015 09:46 AM



Quick Reply: OSX server question - removing data....



All times are GMT +1. The time now is 10:08 PM.