Re: SQL Rights Issue

From: Dan Guzman (danguzman_at_nospam-earthlink.net)
Date: 04/30/04


Date: Thu, 29 Apr 2004 20:17:37 -0500

To allow a non-sysadmin role member to execute xp_cmdshell, you need to
uncheck the 'Only users with Sysadmin privileges...' checkbox in Enterprise
Manager. You can find it by right-clicking on SQL Agent, selecting
Properties and then clicking the Job System tab.

When you uncheck the box in SQL 2000, you'll be prompted for a SQL Agent
Proxy account. This is the Windows account that will be used as the OS
security context when non-sysadmin users execute xp_cmdshell. Ensure the
proxy account has the permissions needed to run your EXE.

You might consider encapsulating xp_cmdshell command need by your app in a
user proc and executing that procedure instead. This way, you don't need to
grant users direct execute permissions on xp_cmdshell. You can do this as
follows:

1) create the user proc (owned by dbo) in your user database

2) grant execute permission on the user proc

3) change your user database owner to 'sa' (EXEC sp_changedbowner 'sa')

4) enable cross-database chaining in your user database (EXEC sp_dboption
'MyDatabase', 'db chaining', true)

Note that you should enable cross-database chaining only if you fully trust
those users who have permissions to create dbo-owned objects.

-- 
Hope this helps.
Dan Guzman
SQL Server MVP
"C.P." <craig_parrish@dontspamme.hotmail.com> wrote in message
news:FB030ACD-B807-49DC-81DB-307787FB2A8F@microsoft.com...
> We have a custom program that is calling the extended stored procedure
xp_cmdshell.  The only way we've been able to get it to successfully run is
by giving the user the System Administrator server role.
>
> We tried setting the user up to have the DBO role on the master database
and giving the user exec rights to xp_cmdshell, but that still did not allow
it to run.
>
> We don't want to assign the System Administrator role to every user who
has to run this program.  What alternatives do we have?
>
> Thanks in advance for your help.
>
> If you would, please email me with posting to this, I might not be able to
find my way back again :)
>
> craig_parrish@snipthispart.hotmail.com
>


Relevant Pages

  • Re: IIS6 - CGI wont run on new website
    ... > Sounds like your CGI is broken and needs to be debugged. ... > Your customer did not correctly configure execute permissions for the ... > instead of execute on server. ... > This configuration controls how IIS handles such ambiguous URLs. ...
    (microsoft.public.inetserver.iis)
  • Re: extended stored procedure catch 22
    ... > And the downside of granting execute permissions on the extended ... assuming that you don't grant execute permissions on the extended ... >>>> user database only if you fully understand the security implications. ... >>>> preventing direct ad-hoc extended stored procedure execution. ...
    (microsoft.public.sqlserver.security)
  • Re: HTTP Error 403.1
    ... Am getting same error even i gave Execute permissions. ... dim sqlclas, sqlSchClas, sqlStuds, changeflag ...
    (microsoft.public.inetserver.iis.security)
  • Re: Some question about FixServerRoleMember
    ... It looks like your customer removed the public execute permissions on this ... This will prevent securityadmin role members from executing the proc. ... > i meet a stranger problem when i use sqlserver fix ServerRoleMember. ...
    (microsoft.public.sqlserver.security)
  • Re: Some question about FixServerRoleMember
    ... "Dan Guzman" дÈëÓʼþ ... > It looks like your customer removed the public execute permissions on this> proc. ... >> first i login sqlserver as SA,and add a new login ...
    (microsoft.public.sqlserver.security)