Re: Running script with admin privileges without admin login
Re: Running script with admin privileges without admin login
- Subject: Re: Running script with admin privileges without admin login
- From: Graff <email@hidden>
- Date: Thu, 05 Feb 2004 13:52:13 -0500
Well you can only use sudo for a command if you are given that
permission in the file "/etc/sudoers". Sudo doesn't really turn you
into the root user, what it does is allow you to use the command with
more than your normal privileges and your use of sudo is logged. This
is why you enter in your password, not the root password.
If you are logged into an account that and want to use a command that
the acount doesn't have privileges for and isn't in the sudoers file
then you need to use the command "su" to switch to a user that has
permission to use the command. For example, you could do this in the
Terminal (you will need to enter a password after the first line):
---------
su admin_user_name
/System/Library/StartupItems/mDNSResponder/mDNSResponder stop
exit
---------
!!!!!!!!!!!!!!!!!!!! BE VERY CAREFUL with the shell command "su".
!!!!!!!!!!!!!!!!!!!!
It is possible to screw things up severely, especially since some of
the protections built into "sudo" are not part of "su".
However, I think that you might not need sudo at all, however. Give
this a try:
---------
do shell script
"/System/Library/StartupItems/mDNSResponder/mDNSResponder stop"
password "password" with administrator privileges
---------
If that doesn't work then try this:
---------
do shell script "su admin_user_name;
/System/Library/StartupItems/mDNSResponder/mDNSResponder stop; exit"
password "password" with administrator privileges
---------
To learn more about "sudo" and "su do "man sudo" and "man su" in the
Terminal. I'd recommend that you read those man pages carefully to
understand how it all works "under the hood"
- Ken
On Feb 5, 2004, at 11:50 AM, Dr. Max Bonilla wrote:
Hello everyone,
Here's a problem one of my colleagues has. Perhaps someone can help
us. He
sent me this explanation:
This script works fine if you execute it as an administrator user, but
not
as a normal user. I'm trying to figure out a way to execute this in the
Student user account, which is not an administrator account. The other
problem is that I am planning on having this script be a hidden login
item,
so any solution that would require the administrator password to be
typed in
is not an option.
on run
do shell script ,
"sudo /System/Library/StartupItems/mDNSResponder/mDNSResponder
stop"
password "password" with administrator privileges
end run
Any ideas? Thanks a million.
Max
_______________________________________________
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.
_______________________________________________
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.