• zsafakhah (9/4/2012)


    Dears all

    how can i restrics xp_CmdShell accesss to run some command?

    for example xp-cmdshell can not run format syntax or delete format?

    how is this possible?

    Best Regards,

    zohreh

    You cannot restrict the commands issued through xp_cmdshell. It is best to avoid enabling xp_cmdshell on your instance for this and others reasons as you lose a lot of control over your instance once it is enabled. All sysadmins can execute any commands they wish and those commands will run in the context of the SQL Server service account, i.e. you lose the ability to audit who did what. You can setup a SQLCLR method to execute in the context of the calling user so you maintain that traceability all the way through the call stack. xp_cmdshell is disabled by default. If you explain more about why you have enabled xp_cmdshell but still want to restrict it in specific ways then more guidance can be offered.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato