Re: Changing ownership of a folder and all contents
Re: Changing ownership of a folder and all contents
- Subject: Re: Changing ownership of a folder and all contents
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 16 Aug 2007 11:34:23 -0400
The sudo command, like most UNIX CLI tools that read passwords, does
so from its terminal, not from standard input, so piping won't work.
But it doesn't matter; you don't need "sudo" if you're using "do shell
script with administrator privileges". That's redundant because sudo
is just the CLI version of "with administrator privileges".
You also used uID twice when I think you wanted the second one to be
the gID (If you don't want to change the group, just specify the uID
once with no colon).
do shell script "chown -R " & uID & ":" & gID & " " & quoted form of
POSIX path of startFolder with administrator privileges
On 8/16/07, Terry Sheltra <email@hidden> wrote:
> I am quite stuck on this problem.
>
> I am creating a script that will copy a user's home directory to new user's
> home directory. I have almost got it working, except that I need to change
> the owner of the new user's home directory temporarily, so that the script
> can copy the files, and then change the owner back after the copy is done.
>
> I've come up with the following:
>
> do shell script "echo " & Pass & " | sudo chown -R " & uID & ":" & uID & "
> /Users/" & uID password Pass with administrator privileges
>
> where Pass and uID are variables containing the admin password and short
> name of the new user respectively.
>
> Everything looks like it should work with no problems. However, when the
> password contains an odd character (in my case, the odd character is an
> exclamation mark), the statement will fail, because I believe that the
> exclamation mark is some kind of reserved character.
>
> Is there a way to pass a password that may contain odd characters to this
> statement?
>
> Alternatively, is there another way to do this in Applescript, using the
> Finder perhaps?
>
> Many thanks for the help!
>
>
>
> Terry Sheltra, Public Mac Support Technician
> University of Virginia School of Architecture
> w:434.982.3047 e:email@hidden
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list
> (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
>
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden