spacer.png, 0 kB
spacer.png, 0 kB
spacer.png, 0 kB
Home
Abilitazioni xp_cmdshell SQL server 2000 PDF Stampa E-mail

How to enable non-sysadmin accounts to execute the "xp_cmdshell" extended stored procedure in SQL Server 2000

Per farla breve:

Method 2: Run a Transact-SQL script

Run the following Transact-SQL script to enable the Windows account to execute the xp_cmdshell extended stored procedure:
-- Set database to master.
USE master
GO
-- Add a valid Windows account as proxy account.
EXECUTE xp_sqlagent_proxy_account N'SET'
, N'<DomainName>'
, N'<WindowsAccount>'
, N'<WindowsPassword>'
GO
-- Get the proxy account to determine whether it is set up correctly. 
EXECUTE xp_sqlagent_proxy_account N'GET'
GO
-- Enable non-system administrators to run the job and to execute xp_cmdshell.
EXECUTE msdb..sp_set_sqlagent_properties @sysadmin_only = 0
GO
Note In this script, <DomainName> is the domain that the Windows account is a member of. <WindowsAccount> is the Windows account name. <WindowsPassword> is the password for the Windows account.

To add the SQL Server login account that you want to grant permission to execute the xp_cmdshell extended stored procedure, run the following Transact-SQL script:
USE master
GO
-- Grant database access to the SQL Server login account that you want to provide access.
EXEC sp_grantdbaccess '<SQLLogin>'
GO
-- Grant execute permission on xp_cmdshell to the SQL Server login account.
GRANT exec ON xp_cmdshell TO <SQLLogin>
GO
Note In this script, <SQLLogin> is the SQL Server login that you want to grant permission to execute the xp_cmdshell extended stored procedure.

Note The proxy account is the Windows account in whose security context the SQL Server Agent jobs or command-line commands are run. When you set up the Windows account for the SQL Server Agent proxy account, you must give the account the Windows-level "Log on as a batch job" user right.

 oppure tutto l'articolo
http://support.microsoft.com/kb/890775

 

 

 
< Prec.   Pros. >
spacer.png, 0 kB