Re: AS to Change Owner of files
Re: AS to Change Owner of files
- Subject: Re: AS to Change Owner of files
- From: Michael Grant <email@hidden>
- Date: Sun, 19 Jan 2003 19:56:23 -0600
>
Thanks for your reply Michael,
>
I have no terminal/unix knowledge. Can you lead to a starting point?
>
First touch with X here. :-)
My advice would be to pick up a beginning UNIX book at a used book store and
spend a couple of hours with it. Changing permissions should be in the first
few chapters. I'm no guru myself, but what you're wanting to do is fairly
basic stuff. You can probably find some 'UNIX for Macheads' tutorials on the
Web too, but I don't have any specific references handy.
>
But is the security at risk if the script is to be used on a specific
>
directory and contained files and compiled? Could the stored password be
>
retrieved???Could you give an example of such script?
To be honest, I don't know whether a password could be retrieved from a
compiled script or not. I'm not paranoid by nature, but enough more
experienced UNIXers do seem to be that I at least try to be cautious.
>
> Can you not just use /Users/Shared?
>
User1 putting a file in /Users/Shared... User2 cannot delete the file since
>
the owner is User1. I need User2 and all others to be able to delete the
>
files in this particular directory. I find /Users/Shared not to be a REAL
>
shared area. Why doesn't elements dropped in there are modified like when it
>
is dropped in a drop box (the drop box changed the owner so that the drop
>
box owner ca do whatever they want with the file).
I see. In that case you don't really need to change ownership or
permissions. You'd need an administrator password to do that on someone
else's files anyway, and if you're going to use the password, you might as
well just delete the files directly.
The script below can be saved as a compiled script and run from the script
menu. It will ask for an administrator password and then delete the selected
files and folders in the front Finder window.
tell application "Finder" to set filelist to the selection
set thePaths to ""
try
repeat with aFile in filelist
set aFile to aFile as alias
set aPath to posixPath aFile
set thePaths to thePaths & "\"" & aPath & "\" "
end repeat
set cmdStr to "sudo /bin/rm -R " & thePaths
do shell script cmdStr with administrator privileges
on error number errNo
do shell script "sudo -k"
error number errNo
end try
-- invalidate sudo password immediately
do shell script "sudo -k"
HTH,
Michael
--
Death to all fanatics!!
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.