What user id is used when you use xp_cmdshell



  • 1. Calculating Folder Size in TSQL
    I am looking for a method to calculate the size of a directory within a stored procedure/function. Basically, I want to do a select on a table, grab all data from the table and get the size of a directory for each record. The select would look something like this... SELECT w.WebsiteName, w.IPAddress, w.Status, c.ClientName, dbo.udfGetFolderSize(w.WebsitePath) as FolderSize -- <-- This is what I am looking for... FROM dbo.Websites w INNER JOIN dbo.Clients c ON c.ID = w.Clients_ID ORDER BY w.WebsiteName, C.ClientName
  • 2. grant (Alter table) permission on a single table in the database
    Product: Microsoft SQL server Enterprise Edition (2000) O/S: MS Windoes NT (5.2) Version: 8.00.760 ===================================================== Can we grant (Alter table) permission on a single table on a database? ( I need to create a new user in a database of about 100 tables. This User needs modify(Change structure of table) permission on a single table. User want to incorporate triggers into the table. Can someone suggest me the best way to grant permission for this. Thanks -- ontario, canada =====================================================
  • 3. transferring database to someone else
    Using SS2000 SP4. If I want to give a copy of one of our servers to somone else, do I need to give them a copy of tempdb or just master, msdb and model and the other databases related to the web site? Thanks, -- Dan D.
  • 4. SQL 2005 Migration - Pass Through Authentication
    Hi We are migrating our existing databases onto new hardware as well as upgrading from SQL Server 2000 to SQL Server 2005. We use web services (IIS) on a separate server to connect into the databases using impersonation. This pass through authentication works fine when connecting to the SQL 2000 database. When connecting through to the SQL 2005 database however the user authenticates on the application server (the security event log shows a successful login using kerberos authentication) but then fails to authenticate on the db server with a 'NT Authority\Anonymous Logon' failure message in the application log. Viewing the Security event log on the db server shows that the logon was attempted using NTLM authentication and not Kerberos. How do we force the kerberos authentication between the app server and the db server rather than it using ntlm? -- Julian Hicks
  • 5. Minimum permission to attach / detach databases
    Hi group, I've got a problem determining permissions for users. I got one group of users which only should have the abilitiy to attach / detach any database to the SQL Server. I just thought the SQL server wide user role dbcreator seems to be sufficient for them but if I try to attach a database on which this group does not have any permission within (its a database from an external vendor), attaching the database fails. Any hints on this? Thanks, Heiko

What user id is used when you use xp_cmdshell

Postby Julie » Tue, 16 Dec 2003 21:23:34 GMT

Dear All,

We have a requirement to copy files onto a virtual unix 
drive.  We will not be using DTS, instead we will use a 
standard .bat command to copy the files over, and we are 
doing this though SQL Server. This will be though the user 
application i.e. the user presses a button which in turn 
creates a file on the server, which in turn copies it onto 
the virtual drive. 

The users who do this will not be systems administrators.

My question is this, in the unix drive we will need to set 
up users, what user should be set up on the virtual drive, 
MSSQLServer, SQLExecutiveCmdExec, or SQLAgentCmdExec ?

Thanks in advance

Re: What user id is used when you use xp_cmdshell

Postby Tibor Karaszi » Tue, 16 Dec 2003 22:40:26 GMT

The user id context used is the proxy account you setup in EM, Management, Right-click Agent,
Properties, Job System.

Tibor Karaszi, SQL Server MVP
Archive at:  http://www.**--****.com/ 

Re: What user id is used when you use xp_cmdshell

Postby Julie » Tue, 16 Dec 2003 23:09:29 GMT

Thanks Tibor,

Thats really sweet of you.


in EM, Management, Right-click Agent,


Similar Threads:

1.Using xp_cmdshell by user with no sysadmin server role

2.Using xp_cmdshell to run application that uses domain credentials

I using MS SQLServer as a secure method of setting up system tasks and
processes for automated running.  The intent is that all logins (ids
and passwords) are in a secure database table and are not sitting
around in batch files on the server.

Some of the tasks make use of network authentication, and this is where
the problem arises.

If I execute the command line from within SQLServer (via xp_cmdshell),
I get an error that says that the userid is missing. If I execute that
same command vid the CMD window, it works.

It appears that the shell that xp_cmdshell kicks off does not inherit
the domain authentication.

Aside from questions on why I am doing things this way as opposed to
using the windows scheduler or other tools, what do I need to do to
make sure that my domain credentials are passed?

3.Using a connection string with a User Id

I have an ASP.NET app that connects to AS2005. I would like to use a
connection string with a User Id similar to the way I would connect to
SQLServer, but I haven't been able to make this work.

The only way the app currently works for me is if I use impersonation,
but I'd rather not do this right now.

I've seen examples for connection strings that look like:

but I haven't got it to work.  Is this possible?


4.Auditing using an application user id

I have created an Audit system, which is using triggers to saves changes to 
my tables. All that works great, my problem is the user.

I my application I have an application User Id and I would actually like to 
use that user in the audit system. Right now I am using the SQL user which 
not is good enough, because they might not be the same as my application 
user. Especially not if the application use a connection string with a sql 
user, or if the data is being updated through a service.

All updates/deletes to my tables is being done through normal sql and not 
through SP's and I can't change this. And if I could this would not fix the 
problems with cascade deletes.

Does anybody have an idea of how I can put the user id somewhere and then 
use it in the triggers?


5.Using User ID to get list of allowed values


I wish to restrict the allowed values for selection for a report parameter
based on the current user.  The query is a selection from the database, I
just need to work out how I can pass the user id to the query.  Users!UserID
fails in a query due to a syntax error.


    UserID = Users!UserID



6. i am having trouble in creating new database using SQL CE

7. What version of SQL am I using?

8. grand total Issue when i am using Case in AS 2005



Who is online

Users browsing this forum: No registered users and 46 guest