<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>REVOKE &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/revoke/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.dbrnd.com</link>
	<description>BIGData &#124; NoSQL &#124; MSSQL &#124; MySQL &#124; PostgreSQL</description>
	<lastBuildDate>Thu, 25 Jan 2018 11:26:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.4</generator>
	<item>
		<title>SQL Server Interview: Revoke all permissions, Grant one Table to User</title>
		<link>https://www.dbrnd.com/2018/02/sql-server-interview-revoke-all-permissions-grant-one-table-to-user/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 12 Feb 2018 16:16:54 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[GRANT]]></category>
		<category><![CDATA[REVOKE]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[SQL Server Error]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tuning]]></category>
		<category><![CDATA[SQL Server Programming]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[Table Permission]]></category>
		<category><![CDATA[TSQL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=7079</guid>

					<description><![CDATA[How to revoke all permissions of a user and grant only one table to that user in SQL Server? If you are SQL DBA and planning for an interview, you should prepare for database security related interview questions. I already published, please check the below link. The Ultimate Page of the SQL Server Interview Questions [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fsql-server-interview-revoke-all-permissions-grant-one-table-to-user%2F&amp;linkname=SQL%20Server%20Interview%3A%20Revoke%20all%20permissions%2C%20Grant%20one%20Table%20to%20User" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fsql-server-interview-revoke-all-permissions-grant-one-table-to-user%2F&amp;linkname=SQL%20Server%20Interview%3A%20Revoke%20all%20permissions%2C%20Grant%20one%20Table%20to%20User" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fsql-server-interview-revoke-all-permissions-grant-one-table-to-user%2F&amp;linkname=SQL%20Server%20Interview%3A%20Revoke%20all%20permissions%2C%20Grant%20one%20Table%20to%20User" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fsql-server-interview-revoke-all-permissions-grant-one-table-to-user%2F&amp;linkname=SQL%20Server%20Interview%3A%20Revoke%20all%20permissions%2C%20Grant%20one%20Table%20to%20User" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fsql-server-interview-revoke-all-permissions-grant-one-table-to-user%2F&amp;linkname=SQL%20Server%20Interview%3A%20Revoke%20all%20permissions%2C%20Grant%20one%20Table%20to%20User" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fsql-server-interview-revoke-all-permissions-grant-one-table-to-user%2F&amp;linkname=SQL%20Server%20Interview%3A%20Revoke%20all%20permissions%2C%20Grant%20one%20Table%20to%20User" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2018%2F02%2Fsql-server-interview-revoke-all-permissions-grant-one-table-to-user%2F&#038;title=SQL%20Server%20Interview%3A%20Revoke%20all%20permissions%2C%20Grant%20one%20Table%20to%20User" data-a2a-url="https://www.dbrnd.com/2018/02/sql-server-interview-revoke-all-permissions-grant-one-table-to-user/" data-a2a-title="SQL Server Interview: Revoke all permissions, Grant one Table to User"></a></p><p><strong>How to revoke all permissions of a user and grant only one table to that user in SQL Server?</strong></p>
<p>If you are SQL DBA and planning for an interview, you should prepare for database security related interview questions. </p>
<p>I already published, please check the below link. </p>
<blockquote class="wp-embedded-content" data-secret="pSRYIoIsqV"><p><a href="https://www.dbrnd.com/sql-server-advance-important-interview-questions-answers-for-database-administrators-developers/">The Ultimate Page of the SQL Server Interview Questions &#038; Answers for Database Administrators and Developers</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/sql-server-advance-important-interview-questions-answers-for-database-administrators-developers/embed/#?secret=pSRYIoIsqV" data-secret="pSRYIoIsqV" width="600" height="338" title="&#8220;The Ultimate Page of the SQL Server Interview Questions &#038; Answers for Database Administrators and Developers&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<p>As a SQL DBA, operating with database permissions is a routine work like giving permission to ad-hoc users and modifying whenever it is required. </p>
<blockquote><p>Last year, I asked this question to a DBA, and I got an answer like &#8220;Remove the user and Create a new user with specific table permission.&#8221;<br />
What do you think? Is this correct answer? &#8211; Partially Yes&#8230; </p>
<p>Before removing a user, you should verify the created objects by that user and create a new user with the same old name.</p></blockquote>
<p><strong>But without doing this all, the answer can be the below script:</strong></p>
<p><strong>Stop access to all tables for a user:</strong></p>
<pre class="crayon-plain-tag">EXEC sp_msforeachtable "DENY ALL ON '?' TO [User_Name];"
GO</pre> </p>
<p><strong>Grant specific table permission:</strong></p>
<pre class="crayon-plain-tag">GRANT ALL ON [Schema_Name].[Table_Name] TO [User_Name]
GO</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Find which object assigns to which user or role and vice versa</title>
		<link>https://www.dbrnd.com/2016/10/postgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 05 Oct 2016 16:16:25 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[access privileges]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[GRANT]]></category>
		<category><![CDATA[has_table_privilege()]]></category>
		<category><![CDATA[object permission]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[pg_has_role()]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[REVOKE]]></category>
		<category><![CDATA[role]]></category>
		<category><![CDATA[user]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3699</guid>

					<description><![CDATA[As a Database Administrator, we are following common practice by creating Database User or Role and assign only require permission to it. When we are assigning different object level permission to particular Database Role, It is also important check total assigned object to particular Database Role or Which object assigned to which Role/User? Most of [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fpostgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list%2F&amp;linkname=PostgreSQL%3A%20Find%20which%20object%20assigns%20to%20which%20user%20or%20role%20and%20vice%20versa" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fpostgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list%2F&amp;linkname=PostgreSQL%3A%20Find%20which%20object%20assigns%20to%20which%20user%20or%20role%20and%20vice%20versa" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fpostgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list%2F&amp;linkname=PostgreSQL%3A%20Find%20which%20object%20assigns%20to%20which%20user%20or%20role%20and%20vice%20versa" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fpostgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list%2F&amp;linkname=PostgreSQL%3A%20Find%20which%20object%20assigns%20to%20which%20user%20or%20role%20and%20vice%20versa" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fpostgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list%2F&amp;linkname=PostgreSQL%3A%20Find%20which%20object%20assigns%20to%20which%20user%20or%20role%20and%20vice%20versa" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fpostgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list%2F&amp;linkname=PostgreSQL%3A%20Find%20which%20object%20assigns%20to%20which%20user%20or%20role%20and%20vice%20versa" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F10%2Fpostgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list%2F&#038;title=PostgreSQL%3A%20Find%20which%20object%20assigns%20to%20which%20user%20or%20role%20and%20vice%20versa" data-a2a-url="https://www.dbrnd.com/2016/10/postgresql-find-which-object-assigns-to-which-user-or-role-and-audit-user-role-assigned-object-list/" data-a2a-title="PostgreSQL: Find which object assigns to which user or role and vice versa"></a></p><p>As a Database Administrator, we are following common practice by creating Database User or Role and assign only require permission to it. </p>
<blockquote><p>When we are assigning different object level permission to particular Database Role, It is also important check total assigned object to particular Database Role or Which object assigned to which Role/User?</p></blockquote>
<blockquote><p>Most of the Database Administrators do not have practice to audit the list of assigned permissions of particular Database User/Role. </p></blockquote>
<blockquote><p>It is fine that we are securing database access using specific role, but that is also similarly important to check information about the assigned object and Database Role.<br />
Periodically, Database Administrator should review the list of permissions which assigned to a Database Role/User.</p></blockquote>
<blockquote><p>PostgreSQL provides list of system functions for auditing User, Role, and its permissions.</p></blockquote>
<p>In PostgreSQL, these functions called as Access Privilege Inquiry Functions.<br />
<a href="https://www.postgresql.org/docs/9.1/static/functions-info.html" target="_blank">You can find list of functions in this official document. </a></p>
<p>I have also prepared a small demonstration of this.</p>
<p><strong>First, Create a sample restricted database ROLE:</strong></p>
<pre class="crayon-plain-tag">CREATE ROLE Test_User WITH LOGIN PASSWORD 'Test1234' 
NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION VALID UNTIL 'infinity';</pre> </p>
<p><strong>Assign SELECT, INSERT permission on one sample tbl_employees table:</strong></p>
<pre class="crayon-plain-tag">GRANT SELECT,INSERT ON tbl_employees TO Test_User;</pre> </p>
<p><strong>Using has_table_privilege(), Script to find list of Users or Roles, who have a INSERT permission on tbl_employees. </strong></p>
<pre class="crayon-plain-tag">SELECT rolname 
FROM pg_roles 
WHERE has_table_privilege(rolname, 'tbl_employees', 'INSERT');</pre> </p>
<p><strong>Using pg_has_role(), Script to find list of objects, on which particular User or Role have INSERT permission. </strong></p>
<pre class="crayon-plain-tag">SELECT 
	DISTINCT relname
FROM pg_roles CROSS JOIN pg_class
WHERE pg_has_role('test_user', rolname, 'MEMBER')
	AND has_table_privilege(rolname, pg_class.oid, 'INSERT');</pre> </p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PostgreSQL: Why New User can access all Databases without any Grants</title>
		<link>https://www.dbrnd.com/2016/08/postgresql-why-new-user-can-access-all-databases-without-any-grants-revoke-connect-permission/</link>
					<comments>https://www.dbrnd.com/2016/08/postgresql-why-new-user-can-access-all-databases-without-any-grants-revoke-connect-permission/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Tue, 16 Aug 2016 17:43:16 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[CONNECT role]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database user]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[GRANT]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[REVOKE]]></category>
		<category><![CDATA[role]]></category>
		<category><![CDATA[security]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3515</guid>

					<description><![CDATA[The Database security is always one of the major tasks for all the Database Administrators. I have also prepared one article to create Read only User in PostgreSQL. PostgreSQL: Script to Create a Read-Only Database User In this post, I am sharing small note about REVOKE privileges for newly created Database Users of PostgreSQL. Before [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F08%2Fpostgresql-why-new-user-can-access-all-databases-without-any-grants-revoke-connect-permission%2F&amp;linkname=PostgreSQL%3A%20Why%20New%20User%20can%20access%20all%20Databases%20without%20any%20Grants" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F08%2Fpostgresql-why-new-user-can-access-all-databases-without-any-grants-revoke-connect-permission%2F&amp;linkname=PostgreSQL%3A%20Why%20New%20User%20can%20access%20all%20Databases%20without%20any%20Grants" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F08%2Fpostgresql-why-new-user-can-access-all-databases-without-any-grants-revoke-connect-permission%2F&amp;linkname=PostgreSQL%3A%20Why%20New%20User%20can%20access%20all%20Databases%20without%20any%20Grants" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F08%2Fpostgresql-why-new-user-can-access-all-databases-without-any-grants-revoke-connect-permission%2F&amp;linkname=PostgreSQL%3A%20Why%20New%20User%20can%20access%20all%20Databases%20without%20any%20Grants" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F08%2Fpostgresql-why-new-user-can-access-all-databases-without-any-grants-revoke-connect-permission%2F&amp;linkname=PostgreSQL%3A%20Why%20New%20User%20can%20access%20all%20Databases%20without%20any%20Grants" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F08%2Fpostgresql-why-new-user-can-access-all-databases-without-any-grants-revoke-connect-permission%2F&amp;linkname=PostgreSQL%3A%20Why%20New%20User%20can%20access%20all%20Databases%20without%20any%20Grants" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F08%2Fpostgresql-why-new-user-can-access-all-databases-without-any-grants-revoke-connect-permission%2F&#038;title=PostgreSQL%3A%20Why%20New%20User%20can%20access%20all%20Databases%20without%20any%20Grants" data-a2a-url="https://www.dbrnd.com/2016/08/postgresql-why-new-user-can-access-all-databases-without-any-grants-revoke-connect-permission/" data-a2a-title="PostgreSQL: Why New User can access all Databases without any Grants"></a></p><p>The Database security is always one of the major tasks for all the Database Administrators.<br />
I have also prepared one article to create Read only User in PostgreSQL. </p>
<blockquote class="wp-embedded-content" data-secret="KAMMknEJXF"><p><a href="https://www.dbrnd.com/2015/10/postgresql-script-to-create-a-read-only-database-user/">PostgreSQL: Script to Create a Read-Only Database User</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2015/10/postgresql-script-to-create-a-read-only-database-user/embed/#?secret=KAMMknEJXF" data-secret="KAMMknEJXF" width="600" height="338" title="&#8220;PostgreSQL: Script to Create a Read-Only Database User&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote><p>In this post, I am sharing small note about REVOKE privileges for newly created Database Users of PostgreSQL. </p></blockquote>
<blockquote><p>Before a few days ago, one of the PostgreSQL Junior DBA asked this question on my FB Page. He created one new DB User in PostgreSQL and without giving a any permission that USER can CONNECT to all Databases. </p></blockquote>
<blockquote><p>Yes: When you create any new DB User in PostgreSQL, It has a default CONNECT privileges.<br />
But It cannot access any Table or data of Databases, yes It can create new Table in any Database. </p></blockquote>
<p>To prevent a new User for connecting any existing Database, we should run REVOKE command on particular User or Role.</p>
<p><strong>REVOKE CONNECT privileges from Database:</strong></p>
<pre class="crayon-plain-tag">REVOKE CONNECT ON DATABASE Database_Name FROM User_Name;</pre> </p>
<p><strong>REVOKE all privileges from Database: </strong></p>
<pre class="crayon-plain-tag">REVOKE ALL PRIVILEGES ON DATABASE Database_Name FROM User_Name;</pre> </p>
<p><strong>You should GRANT only required Databases:</strong></p>
<pre class="crayon-plain-tag">GRANT CONNECT ON DATABASE Database_Name TO User_Name;</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/08/postgresql-why-new-user-can-access-all-databases-without-any-grants-revoke-connect-permission/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: Database Security Interview Questions and Answers  (Day-5)</title>
		<link>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5/</link>
					<comments>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 22 Jul 2016 14:06:57 +0000</pubDate>
				<category><![CDATA[SQL Server Interview]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[database security]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[deny]]></category>
		<category><![CDATA[GRANT]]></category>
		<category><![CDATA[interview]]></category>
		<category><![CDATA[questions]]></category>
		<category><![CDATA[REVOKE]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server Administrator]]></category>
		<category><![CDATA[sql server audit]]></category>
		<category><![CDATA[SQL Server Monitoring]]></category>
		<category><![CDATA[SQL Server Performance Tunning]]></category>
		<category><![CDATA[SQL Server Tips and Tricks]]></category>
		<category><![CDATA[TSQL]]></category>
		<category><![CDATA[XP_CMDSHELL]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=3378</guid>

					<description><![CDATA[What do you know about the SQL Server Audit? SQL Server Audit is used to track and log events (not data change) occurring on the SQL Server. SQL Server uses extended events to help create an audit. The audit can be server level or database level. If you create an audit on a database table, [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&amp;linkname=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2016%2F07%2Fsql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5%2F&#038;title=SQL%20Server%3A%20Database%20Security%20Interview%20Questions%20and%20Answers%20%20%28Day-5%29" data-a2a-url="https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5/" data-a2a-title="SQL Server: Database Security Interview Questions and Answers  (Day-5)"></a></p><p><strong>What do you know about the SQL Server Audit?</strong></p>
<blockquote><p>SQL Server Audit is used to track and log events (not data change) occurring on the SQL Server. SQL Server uses extended events to help create an audit. The audit can be server level or database level.</p>
<p>If you create an audit on a database table, SQL Server will only track the events that trigger the certain operations (SELECT/INSERT/UPDATE/DELETE) defined in the database audit specification.</p></blockquote>
<p><strong>What options are available to audit login activity?</strong></p>
<ul>
<li>Custom solution with your application to log all logins into a centralized table</li>
<li>Enable login auditing at the instance level in Management Studio</li>
<li>Execute Profiler to capture logins into the instance</li>
<li>Leverage a third party product</li>
</ul>
<p><strong>What is Audit in SQL Server?</strong></p>
<blockquote><p>Auditing an instance of the SQL Server Database Engine or an individual database involves tracking and logging events that occur on the Database Engine.</p></blockquote>
<p><strong>What is Server level Audit specification?</strong></p>
<blockquote><p>You can create one server audit specification per audit.</p>
<p>The server audit specification collects many server-level action groups raised by the Extended Events feature. You can include audit action groups in a server audit specification. Audit action groups are predefined groups of actions, which are atomic events occurring in the Database Engine.</p></blockquote>
<p><strong>What is Database level Audit specification?</strong></p>
<blockquote><p>You can create one database audit specification per SQL Server database per audit.</p>
<p>The database audit specification collects database-level audit actions raised by the Extended Events feature. You can add either audit action groups or audit events to a database audit specification.</p></blockquote>
<p><strong>Is it good to enable Audit only for SQL Server Login fails?</strong></p>
<blockquote><p>Yes:</p>
<p>Database administrators should enable login auditing feature of SQL Server on all instances which they manage. Once this feature is enabled SQL Server will write all the failed and successful login information in SQL Server Error Logs. It is always a best practice to auditing failed SQL Server logins.</p></blockquote>
<p><strong>Does SQL Server Audit require any additional permission?</strong></p>
<blockquote><p>Yes:</p>
<p>Each feature and command for SQL Server Audit has individual permission requirements.</p></blockquote>
<p><strong>Should we encrypt the SQL Server datatabase backups?</strong></p>
<blockquote><p>Yes:</p>
<p>We need to make sure the database backups are encrypted to avoid the misuse.</p></blockquote>
<p><strong>Why we should not use tha SA login for all the different SQL Server access?</strong></p>
<blockquote><p>Because, the sa login and password to all of your SQL Servers because auditing the sa login with a shared password is difficult without capturing the host name or some other personally identifiable data. We should migrate all SQL Server authentication to Windows based authentication.</p></blockquote>
<p><strong>Can I stop a System Admin from enabling SQL Server xp_cmdshell?</strong></p>
<blockquote><p>No:</p></blockquote>
<p><strong>T-SQL script to disable the SA login</strong></p><pre class="crayon-plain-tag">ALTER LOGIN sa DISABLE;</pre><p>
<strong>T-SQL script to rename the SQ login.</strong></p><pre class="crayon-plain-tag">ALTER LOGIN sa WITH NAME = [dbrnd_user];</pre><p>
<strong>Please do auto reset the SA password and disable it.</strong></p>
<blockquote><p>SQL Server has an undocumented system stored procedure named sp_SetAutoSAPasswordAndDisable. This procedure will do exactly as the name suggests: it will reset the password and then disable the &#8216;sa&#8217; login.</p></blockquote>
<pre class="crayon-plain-tag">EXEC sp_SetAutoSAPasswordAndDisable
GO</pre>
<strong>T-SQL script to find common passwords.</strong><br />
<pre class="crayon-plain-tag">SELECT name,type_desc,create_date,modify_date,password_hash 
FROM sys.sql_logins 
WHERE PWDCOMPARE('mssqltips',password_hash)=1;</pre>
<strong>T-SQL script to find blank passwords.</strong><br />
<pre class="crayon-plain-tag">SELECT name,type_desc,create_date,modify_date,password_hash 
FROM sys.sql_logins 
WHERE PWDCOMPARE('',password_hash)=1;</pre>
<strong>T-SQL script to find Passwords that are the same as the Login name.</strong><br />
<pre class="crayon-plain-tag">SELECT name,type_desc,create_date,modify_date,password_hash 
FROM sys.sql_logins 
WHERE PWDCOMPARE(name,password_hash)=1;</pre>
<strong>What is GRANT, DENY and REVOKE?</strong></p>
<blockquote><p>GRANT:gives a user permission to perform certain tasks on database objects.<br />
DENY:denies any access to a user to perform certain tasks on database objects.<br />
REVOKE:removes a grant or deny permission from a user on certain database objects.</p></blockquote>
<p><strong>Sample T-SQL scripts for GRANT, DENY and REVOKE.</strong><br />
<pre class="crayon-plain-tag">GRANT INSERT, UPDATE, SELECT ON Customers TO Joe, Mary;
DENY DELETE ON Customers to Joe, Mary;
REVOKE UPDATE ON Customers to Joe;</pre>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/07/sql-server-database-security-interview-questions-and-answers-sql-audit-xp_cmdshell-sa-login-grant-deny-revoke-day-5/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: Prevent New User to access Newly Created Database</title>
		<link>https://www.dbrnd.com/2015/11/postgresql-prevent-new-user-to-access-newly-created-database/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Fri, 27 Nov 2015 16:08:48 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[GRANT]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres Query]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[PostgreSQL Administrator]]></category>
		<category><![CDATA[PostgreSQL Error]]></category>
		<category><![CDATA[PostgreSQL Programming]]></category>
		<category><![CDATA[PostgreSQL Tips and Tricks]]></category>
		<category><![CDATA[REVOKE]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=1075</guid>

					<description><![CDATA[Sharing one of the important articles for the PostgreSQL Professionals. In PostgreSQL, when you create a new user without specifying any grant or rule, by default it the user can access all databases. Postgres internally provides a PUBLIC grant to the newly created user. So here, Database security is one of primary concern for us. [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2015%2F11%2Fpostgresql-prevent-new-user-to-access-newly-created-database%2F&amp;linkname=PostgreSQL%3A%20Prevent%20New%20User%20to%20access%20Newly%20Created%20Database" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_twitter" href="https://www.addtoany.com/add_to/twitter?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2015%2F11%2Fpostgresql-prevent-new-user-to-access-newly-created-database%2F&amp;linkname=PostgreSQL%3A%20Prevent%20New%20User%20to%20access%20Newly%20Created%20Database" title="Twitter" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_linkedin" href="https://www.addtoany.com/add_to/linkedin?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2015%2F11%2Fpostgresql-prevent-new-user-to-access-newly-created-database%2F&amp;linkname=PostgreSQL%3A%20Prevent%20New%20User%20to%20access%20Newly%20Created%20Database" title="LinkedIn" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pinterest" href="https://www.addtoany.com/add_to/pinterest?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2015%2F11%2Fpostgresql-prevent-new-user-to-access-newly-created-database%2F&amp;linkname=PostgreSQL%3A%20Prevent%20New%20User%20to%20access%20Newly%20Created%20Database" title="Pinterest" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_reddit" href="https://www.addtoany.com/add_to/reddit?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2015%2F11%2Fpostgresql-prevent-new-user-to-access-newly-created-database%2F&amp;linkname=PostgreSQL%3A%20Prevent%20New%20User%20to%20access%20Newly%20Created%20Database" title="Reddit" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_pocket" href="https://www.addtoany.com/add_to/pocket?linkurl=https%3A%2F%2Fwww.dbrnd.com%2F2015%2F11%2Fpostgresql-prevent-new-user-to-access-newly-created-database%2F&amp;linkname=PostgreSQL%3A%20Prevent%20New%20User%20to%20access%20Newly%20Created%20Database" title="Pocket" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fwww.dbrnd.com%2F2015%2F11%2Fpostgresql-prevent-new-user-to-access-newly-created-database%2F&#038;title=PostgreSQL%3A%20Prevent%20New%20User%20to%20access%20Newly%20Created%20Database" data-a2a-url="https://www.dbrnd.com/2015/11/postgresql-prevent-new-user-to-access-newly-created-database/" data-a2a-title="PostgreSQL: Prevent New User to access Newly Created Database"></a></p><p>Sharing one of the important articles for the PostgreSQL Professionals. </p>
<p>In PostgreSQL, when you create a new user without specifying any grant or rule, by default it the user can access all databases.</p>
<p>Postgres internally provides a PUBLIC grant to the newly created user. </p>
<p>So here, Database security is one of primary concern for us. </p>
<p><a href="https://www.dbrnd.com/2015/10/postgresql-script-to-create-a-read-only-database-user/" target="_blank">You can refer this article to create, read only user in PostgreSQL. </a></p>
<p><strong>If you want to prevent the user from accessing all the databases, use below REVOKE script. </strong></p>
<pre class="crayon-plain-tag">REVOKE CONNECT ON DATABASE database_name FROM PUBLIC;</pre> </p>
<p>My advice is to always create the customized database role for application and read-only user. </p>
<p><strong>After executing revoke command, you can grant CONNECT to your Database Role. </strong></p>
<pre class="crayon-plain-tag">GRANT CONNECT ON DATABASE database_name TO role_name;</pre> </p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
