how win 2003 server maps sa sql 2005 account?

  • Hi expert,

    I hope somebody can help me with this issue.

    I'm trying to run this command:

    declare @cmd varchar(500)

    Set @cmd='"c:\program files\coreftp\coreftp.exe" -s -O -u c:\files\myzip.zip -site MyFtpSite -p /users/'

    EXEC master..xp_cmdshell @cmd

    This script is correct because it runs successfully from DOS.

    But when I try to run this from sql with a command shell it just hangs up forever.

    I believe this is a security issue, first time I use this account I need to accept a SSL certificate, I did that using the GUI. But this script will run with another win network account (which one?), not my network user account, so I believe it hangs up just because it is waiting somebody to accept this certificate but I cannot because I don't have access to the GUI.

    Does anyone has any idea how to work around this?

    Thank you!

    Claudia

    I have SQL Server 2005 installed on Window Server 2003 standard edition.

  • xp_cmdshell is disabled by default in SQL Server 2005. Have you enabled it? If not, go to the Surface Area Configuration tool>>Surface Area Configuration for Features and enable it then try again. If it is already enabled, consider looking into security. SQL Server will execute xp_Cmdshell within the context of the SQL Server Service account. Make sure that account has permissions to run the executable.

    John Rowan

    ======================================================
    ======================================================
    Forum Etiquette: How to post data/code on a forum to get the best help[/url] - by Jeff Moden

  • Hi John, and thanks for your answer.

    I've already enabled the command shell, it runs fine for others job that doesn't involve an FTP.

    How can I find out the win account that SQL server is using when the command sheel is running? I don't know a lot about security, it has to be a mapping between the sql account sa and the windows account that is running the script.

    Thank you!

    Claudia

  • I believe for SAs it runs as the SQL Server Agent account.

  • Since xp_cmdshell appears to hang you should be able to see the username in Task Manager under the Process tab; look for cmd.exe or coreftp.exe.

    Once you have the username you could logon to that server as that user and run coreftp.exe to take care of the onetime setup. Or, you could use the RUNAS at a command prompt to launch coreftp.exe as that user.

    For example, if the account is a domain account.

    C:\RUNAS /profile /user:mydomain\myusername "coreftp.exe"

    If it's running under the SYSTEM account then you might be able to do something like this; PSEXEC is part of PSTools collection from Microsoft http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx

    C:\PSEXEC -s -i coreftp.exe

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply