Solved

permissions to hit sysobjects

Posted on 2010-09-09
14
597 Views
Last Modified: 2012-05-10
what permissions does a user need to be able to select sysobjects?

thanks
0
Comment
Question by:anushahanna
  • 6
  • 4
  • 2
  • +2
14 Comments
 
LVL 11

Accepted Solution

by:
aelliso3 earned 300 total points
ID: 33639696
the just need SELECT permissions:
 
GRANT SELECT ON sys.sysobjects to anushahanna,
0
 
LVL 6

Author Comment

by:anushahanna
ID: 33639740
he does't hit it, still. can you see why?
create proc test as select 1

create login testlogin with password =  'password1!'

create user testuser FOR LOGIN testlogin

grant select on sysobjects to testuser

execute as user = 'testuser'

select * from sysobjects where type = 'P' and name = 'test'

revert

drop user testuser

drop login testlogin

drop proc test

Open in new window

0
 
LVL 5

Assisted Solution

by:tvPrasad
tvPrasad earned 100 total points
ID: 33639742
account with sysadmin permissions
0
 
LVL 11

Expert Comment

by:aelliso3
ID: 33639917
It's working great on mine ... Are you using a seperate session to execute the sproc?
create proc test as select 1

create login testlogin with password =  'password1!'

create user testuser FOR LOGIN testlogin

grant select on sysobjects to testuser

execute as user = 'testuser'

select * from sysobjects where type = 'P' and name = 'test'

revert

drop user testuser

drop login testlogin

drop proc test

GO 



EXEC test

Open in new window

0
 
LVL 6

Author Comment

by:anushahanna
ID: 33640028
aelliso3, i still could not make it happen. can you execute it without the 'EXEC test' line- that is not needed for this test, right?

I changed you code with lots of GOs to make it sure that it will err out... can you try this:
----------------------------
create proc test as select 1;
GO
create login testlogin with password =  'password1!';
GO
create user testuser FOR LOGIN testlogin;
GO
grant select on sysobjects to testuser;
GO
execute as user = 'testuser';
GO
select * from sysobjects where type = 'P' and name = 'test';
GO
select system_user;
GO
revert;
GO
select system_user;
GO
drop user testuser;
GO
drop login testlogin;
GO
drop proc test;
0
 
LVL 6

Author Comment

by:anushahanna
ID: 33640057
tvPrasad, other than sysadmin, any other lower level roles?
0
 
LVL 142

Assisted Solution

by:Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3] earned 100 total points
ID: 33640226
actually, to READ ( SELECT) sysobject/sys.objects, you need no rights, because public role has read permissions to it implicitly, and any login mapped to the database (aka user) has public role implicitly.this is anyhow required, otherwise the user would not be able to "see" which objects he has actually permissions to and which not ...
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 5

Expert Comment

by:tvPrasad
ID: 33640243
you can try

GRANT SELECT, EXECUTE ON sys.sysobjects TO anushahanna
0
 
LVL 6

Author Comment

by:anushahanna
ID: 33640444
angelIII, tvPrasad - that does not seem to be sufficient..

please run the code in # 33640028 above.
0
 
LVL 11

Assisted Solution

by:aelliso3
aelliso3 earned 300 total points
ID: 33641290
Try this ...


CREATE LOGIN testlogin WITH PASSWORD='password1!'

ALTER LOGIN testlogin ENABLE

GO



create user testuser FOR LOGIN testlogin;

GO



CREATE PROC test AS SELECT 1

GO

GRANT EXECUTE ON master.dbo.test TO testuser

GRANT VIEW DEFINITION ON master.dbo.test TO testuser



GO



--GRANT select on sysobjects to testuser;

GO

EXECUTE AS user = 'testuser';

SELECT * FROM sysobjects WHERE TYPE = 'P' AND NAME = 'test';

SELECT system_user;

GO 

REVERT

GO

drop user testuser;

GO

drop login testlogin;

GO

drop proc test;

GO

Open in new window

0
 
LVL 11

Assisted Solution

by:aelliso3
aelliso3 earned 300 total points
ID: 33641349
I wanted to take a second and go through and eliminate what was not needed in the script above. Below is a little cleaner version ...
CREATE LOGIN testlogin WITH PASSWORD='password1!'

CREATE USER testuser FOR LOGIN testlogin

GO



CREATE PROC test AS SELECT 1

GO



GRANT EXECUTE ON master.dbo.test TO testuser



EXECUTE AS user = 'testuser'

SELECT * FROM sysobjects WHERE TYPE = 'P' AND NAME = 'test'

SELECT system_user

GO 



REVERT

DROP USER testuser

DROP LOGIN testlogin

DROP PROC test

GO

Open in new window

0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 33642807
Just for the record, are you still using SQL Server 2000, because all the solutions so far seem to assume you are using SQL Server 2005.
0
 
LVL 6

Author Comment

by:anushahanna
ID: 33646980
aelliso3, i see your point. thanks.
0
 
LVL 6

Author Comment

by:anushahanna
ID: 33646982
acperkins, this pertained to SQL 2005, and helped. thank you.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
MS SQL Backup 24 70
INSERT INTO SELECT JOIN THING 2 25
Azure SQL DB? 3 15
Access Migration to Sql Server 2 19
I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now