Home > Archive > MS SQL Server > November 2006 > xp_cmdshell -- access denied => suggestions ?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author xp_cmdshell -- access denied => suggestions ?
ina

2006-11-08, 5:16 am

Hello guys,

I have a problem with the xp_cmdshell in sql server 2000.

xp_cmdshell "@echo start > C:\File.txt"
declare @str varchar(255)
select @str= 'isql -Q"select * from authors" -E -oc:/File.txt'
exec master..xp_cmdshell @str

when I tried to execute this query in Query Analyser I had this mistake

Access is denied.

Also I am having this mistake: RegCreateKeyEx() return error (5) --
access denied'
when I tried to change server properties.

Do you thing that anyhow this two access denied are correlated?

I am using SQL SERVER
sa login
my user profile is part of administrator of this server (a virtual
server)

regards,

ina

Uri Dimant

2006-11-08, 5:16 am

ina
I have justv ran this scipt and it works fine

declare @str varchar(255)
select @str= 'isql -Q"select * from pubs..authors" -E -oC:/File.txt'
exec master..xp_cmdshell @str




"ina" <roberta.inalbon@gmail.com> wrote in message
news:1162980520.848858.200160@m73g2000cwd.googlegroups.com...
> Hello guys,
>
> I have a problem with the xp_cmdshell in sql server 2000.
>
> xp_cmdshell "@echo start > C:\File.txt"
> declare @str varchar(255)
> select @str= 'isql -Q"select * from authors" -E -oc:/File.txt'
> exec master..xp_cmdshell @str
>
> when I tried to execute this query in Query Analyser I had this mistake
>
> Access is denied.
>
> Also I am having this mistake: RegCreateKeyEx() return error (5) --
> access denied'
> when I tried to change server properties.
>
> Do you thing that anyhow this two access denied are correlated?
>
> I am using SQL SERVER
> sa login
> my user profile is part of administrator of this server (a virtual
> server)
>
> regards,
>
> ina
>



ina

2006-11-08, 5:16 am

Uri thanks,

I know that in others machine this script works fine but not in mine
machine. I have all the time this access denied. Do you thing that do I
need to change something permission? or permission on cmd.exe???

ina
Uri Dimant wrote:[color=darkred
]
> ina
> I have justv ran this scipt and it works fine
>
> declare @str varchar(255)
> select @str= 'isql -Q"select * from pubs..authors" -E -oC:/File.txt'
> exec master..xp_cmdshell @str
>
>
>
>
> "ina" <roberta.inalbon@gmail.com> wrote in message
> news:1162980520.848858.200160@m73g2000cwd.googlegroups.com...

Uri Dimant

2006-11-08, 5:16 am

ina
Definitely it is permissions issue. Check out whether or not you have an
access to the C:\ disk , i mean create a new file .....
Are you a memeber of sysadmin server role? As I remember well only members
of this role have permissions to run xp_cmdshell procedure



"ina" <roberta.inalbon@gmail.com> wrote in message
news:1162981656.000688.161780@m7g2000cwm.googlegroups.com...
> Uri thanks,
>
> I know that in others machine this script works fine but not in mine
> machine. I have all the time this access denied. Do you thing that do I
> need to change something permission? or permission on cmd.exe???
>
> ina
> Uri Dimant wrote:
>



ina

2006-11-08, 7:12 pm

sysadmin in sql server? yes I am using sa login, normally the sa login
has all right.

Where can I ckeck the rights for my users?

regards,

ina

On Nov 8, 11:38 am, "Uri Dimant" <u...@iscar.co.il> wrote:[color=darkred
]
> ina
> Definitely it is permissions issue. Check out whether or not you have an
> access to the C:\ disk , i mean create a new file .....
> Are you a memeber of sysadmin server role? As I remember well only members
> of this role have permissions to run xp_cmdshell procedure
>
> "ina" <roberta.inal...@gmail.com> wrote in messagenews:11629816
56.000688.161780@m7g2000cwm.googlegroups.com...
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

ina

2006-11-08, 7:12 pm

Uri,

I tried to create a file in C and it's working. But not with the
xp_cmdshell maybe I do not have permission to execute the cmd.exe for
my login in this server

On Nov 8, 11:38 am, "Uri Dimant" <u...@iscar.co.il> wrote:[color=darkred
]
> ina
> Definitely it is permissions issue. Check out whether or not you have an
> access to the C:\ disk , i mean create a new file .....
> Are you a memeber of sysadmin server role? As I remember well only members
> of this role have permissions to run xp_cmdshell procedure
>
> "ina" <roberta.inal...@gmail.com> wrote in messagenews:11629816
56.000688.161780@m7g2000cwm.googlegroups.com...
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

Tibor Karaszi

2006-11-08, 7:12 pm

When a sysadmins uses xp_cmdshell, the process is using the same permission context as the service
account for the SQL Server service. So, make sure that the SQL Server service service account has
permissions to do these operations.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www. solidqualitylearning
.com/



"ina" <roberta.inalbon@gmail.com> wrote in message
news:1162980520.848858.200160@m73g2000cwd.googlegroups.com...
> Hello guys,
>
> I have a problem with the xp_cmdshell in sql server 2000.
>
> xp_cmdshell "@echo start > C:\File.txt"
> declare @str varchar(255)
> select @str= 'isql -Q"select * from authors" -E -oc:/File.txt'
> exec master..xp_cmdshell @str
>
> when I tried to execute this query in Query Analyser I had this mistake
>
> Access is denied.
>
> Also I am having this mistake: RegCreateKeyEx() return error (5) --
> access denied'
> when I tried to change server properties.
>
> Do you thing that anyhow this two access denied are correlated?
>
> I am using SQL SERVER
> sa login
> my user profile is part of administrator of this server (a virtual
> server)
>
> regards,
>
> ina
>


ina

2006-11-09, 7:13 pm

Thanks Tibor I will check it

Tibor Karaszi wrote:
[color=darkred]
> When a sysadmins uses xp_cmdshell, the process is using the same permission context as the service
> account for the SQL Server service. So, make sure that the SQL Server service service account has
> permissions to do these operations.
>
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www. solidqualitylearning
.com/

>
>
> "ina" <roberta.inalbon@gmail.com> wrote in message
> news:1162980520.848858.200160@m73g2000cwd.googlegroups.com...

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com