Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2002
    Posts
    58

    Unanswered: Security question

    I have a shell command to copy a file from another server that I can execute successfully when I do it via a command prompt. When I try running it in QA it tells me access is denied:
    Code:
    EXEC master..xp_cmdshell 'copy \\OtherServer\ftp\file.txt c:\ftp\file.txt'
    How can I get this to run under my rights so it can access the other server?

  2. #2
    Join Date
    Jul 2004
    Posts
    191
    I think you need to have sys admin rights on both servers.

    I hope that helps

    Lystra

  3. #3
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Login the NT Service for SQL Server using your NT Credentials. See MSDN for details.

    -PatP

  4. #4
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    Keep in mind that if you eventually will decide to schedule it, - you'll need the same permissions to be given to the account that is used by SQLAgent.
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Quote Originally Posted by rdjabarov
    Keep in mind that if you eventually will decide to schedule it, - you'll need the same permissions to be given to the account that is used by SQLAgent.
    Good point if the copy is done directly from SQL Agent instead of xp_cmdshell!

    -PatP

  6. #6
    Join Date
    Jul 2003
    Location
    San Antonio, TX
    Posts
    3,662
    At the time of execution of xp_cmdshell the security context of the current login is being used (vs. pre-SP3 behavior)
    "The data in a record depends on the Key to the record, the Whole Key, and
    nothing but the Key, so help me Codd."

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •