<?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>permission &#8211; Database Research &amp; Development</title>
	<atom:link href="https://www.dbrnd.com/tag/permission/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>Sat, 23 Sep 2017 07:42:45 +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>PostgreSQL Error &#8211; FATAL: database role &#8220;root&#8221; does not exist in Linux</title>
		<link>https://www.dbrnd.com/2017/01/postgresql-error-fatal-database-role-root-does-not-exist-in-linux/</link>
					<comments>https://www.dbrnd.com/2017/01/postgresql-error-fatal-database-role-root-does-not-exist-in-linux/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Mon, 23 Jan 2017 21:21:42 +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[fatal]]></category>
		<category><![CDATA[login]]></category>
		<category><![CDATA[login fail]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[plpgsql]]></category>
		<category><![CDATA[Postgres]]></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[role]]></category>
		<category><![CDATA[role does not exist]]></category>
		<category><![CDATA[username]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4105</guid>

					<description><![CDATA[A PostgreSQL Fatal error like role or username does not exist. This is a very common error which is facing by PostgreSQL Users. Actually, this is happening because of misconfiguration of System username and Database Username. Most of the Linux users are trying to log in PostgreSQL using root user. But actually, this is wrong. [&#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%2F2017%2F01%2Fpostgresql-error-fatal-database-role-root-does-not-exist-in-linux%2F&amp;linkname=PostgreSQL%20Error%20%E2%80%93%20FATAL%3A%20database%20role%20%E2%80%9Croot%E2%80%9D%20does%20not%20exist%20in%20Linux" 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%2F2017%2F01%2Fpostgresql-error-fatal-database-role-root-does-not-exist-in-linux%2F&amp;linkname=PostgreSQL%20Error%20%E2%80%93%20FATAL%3A%20database%20role%20%E2%80%9Croot%E2%80%9D%20does%20not%20exist%20in%20Linux" 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%2F2017%2F01%2Fpostgresql-error-fatal-database-role-root-does-not-exist-in-linux%2F&amp;linkname=PostgreSQL%20Error%20%E2%80%93%20FATAL%3A%20database%20role%20%E2%80%9Croot%E2%80%9D%20does%20not%20exist%20in%20Linux" 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%2F2017%2F01%2Fpostgresql-error-fatal-database-role-root-does-not-exist-in-linux%2F&amp;linkname=PostgreSQL%20Error%20%E2%80%93%20FATAL%3A%20database%20role%20%E2%80%9Croot%E2%80%9D%20does%20not%20exist%20in%20Linux" 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%2F2017%2F01%2Fpostgresql-error-fatal-database-role-root-does-not-exist-in-linux%2F&amp;linkname=PostgreSQL%20Error%20%E2%80%93%20FATAL%3A%20database%20role%20%E2%80%9Croot%E2%80%9D%20does%20not%20exist%20in%20Linux" 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%2F2017%2F01%2Fpostgresql-error-fatal-database-role-root-does-not-exist-in-linux%2F&amp;linkname=PostgreSQL%20Error%20%E2%80%93%20FATAL%3A%20database%20role%20%E2%80%9Croot%E2%80%9D%20does%20not%20exist%20in%20Linux" 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%2F2017%2F01%2Fpostgresql-error-fatal-database-role-root-does-not-exist-in-linux%2F&#038;title=PostgreSQL%20Error%20%E2%80%93%20FATAL%3A%20database%20role%20%E2%80%9Croot%E2%80%9D%20does%20not%20exist%20in%20Linux" data-a2a-url="https://www.dbrnd.com/2017/01/postgresql-error-fatal-database-role-root-does-not-exist-in-linux/" data-a2a-title="PostgreSQL Error – FATAL: database role “root” does not exist in Linux"></a></p><p>A PostgreSQL Fatal error like role or username does not exist. This is a very common error which is facing by PostgreSQL Users.</p>
<blockquote><p>Actually, this is happening because of misconfiguration of System username and Database Username.
</p></blockquote>
<blockquote><p>Most of the Linux users are trying to log in PostgreSQL using root user. But actually, this is wrong. </p></blockquote>
<blockquote><p>You will need to become the operating system user under which PostgreSQL was installed to create the first user account.</p></blockquote>
<blockquote><p>Generally, the default user name is Postgres and default database is also Postgres.<br />
Once you install PostgreSQL on Linux, you should set the password for the Postgres user which is the default super user of PostgreSQL. </p></blockquote>
<blockquote><p>Please do not try to log in with any other default Linux or Unix system user name.
</p></blockquote>
<p><strong>Set password for the default Postgres user:<br />
</strong></p>
<pre class="crayon-plain-tag">sudo passwd postgres</pre> </p>
<p><strong>Create another role using &#8220;postgres&#8221;:<br />
</strong>Creating new role &#8220;dbrnd&#8221;. -p = set the password and -d = allow to create database.</p>
<pre class="crayon-plain-tag">sudo -u postgres createuser dbrnd -d -P</pre> </p>
<blockquote class="wp-embedded-content" data-secret="zQcnw6C0WT"><p><a href="https://www.dbrnd.com/2016/04/postgresql-how-to-install-postgresql-9-4-on-ubuntu-14-04/">PostgreSQL: How to Install PostgreSQL 9.4 on Ubuntu 14.04?</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/04/postgresql-how-to-install-postgresql-9-4-on-ubuntu-14-04/embed/#?secret=zQcnw6C0WT" data-secret="zQcnw6C0WT" width="600" height="338" title="&#8220;PostgreSQL: How to Install PostgreSQL 9.4 on Ubuntu 14.04?&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote class="wp-embedded-content" data-secret="ViFF2aw9xL"><p><a href="https://www.dbrnd.com/2017/01/postgresql-how-to-install-postgresql-9-6-on-ubuntu-16-04/">PostgreSQL: How to Install PostgreSQL 9.6 on Ubuntu 16.04?</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2017/01/postgresql-how-to-install-postgresql-9-6-on-ubuntu-16-04/embed/#?secret=ViFF2aw9xL" data-secret="ViFF2aw9xL" width="600" height="338" title="&#8220;PostgreSQL: How to Install PostgreSQL 9.6 on Ubuntu 16.04?&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2017/01/postgresql-error-fatal-database-role-root-does-not-exist-in-linux/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>PostgreSQL: pg_ident.conf to map Operating System Username and Database Username</title>
		<link>https://www.dbrnd.com/2016/12/postgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password/</link>
					<comments>https://www.dbrnd.com/2016/12/postgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 08 Dec 2016 18:19:29 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[operating system]]></category>
		<category><![CDATA[Password]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[pg_hba.conf]]></category>
		<category><![CDATA[pg_ident.conf]]></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[user]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=4013</guid>

					<description><![CDATA[If you do not know about the role of pg_hba.conf file, visit the below link. PostgreSQL: How to Allow Remote Connection to Connect Database PostgreSQL also has a one more file related user access permission and that is pg_ident.conf. PostgreSQL provides Ident-based authentication and It works by obtaining the client&#8217;s operating system user name and [&#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%2F12%2Fpostgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password%2F&amp;linkname=PostgreSQL%3A%20pg_ident.conf%20to%20map%20Operating%20System%20Username%20and%20Database%20Username" 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%2F12%2Fpostgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password%2F&amp;linkname=PostgreSQL%3A%20pg_ident.conf%20to%20map%20Operating%20System%20Username%20and%20Database%20Username" 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%2F12%2Fpostgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password%2F&amp;linkname=PostgreSQL%3A%20pg_ident.conf%20to%20map%20Operating%20System%20Username%20and%20Database%20Username" 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%2F12%2Fpostgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password%2F&amp;linkname=PostgreSQL%3A%20pg_ident.conf%20to%20map%20Operating%20System%20Username%20and%20Database%20Username" 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%2F12%2Fpostgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password%2F&amp;linkname=PostgreSQL%3A%20pg_ident.conf%20to%20map%20Operating%20System%20Username%20and%20Database%20Username" 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%2F12%2Fpostgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password%2F&amp;linkname=PostgreSQL%3A%20pg_ident.conf%20to%20map%20Operating%20System%20Username%20and%20Database%20Username" 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%2F12%2Fpostgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password%2F&#038;title=PostgreSQL%3A%20pg_ident.conf%20to%20map%20Operating%20System%20Username%20and%20Database%20Username" data-a2a-url="https://www.dbrnd.com/2016/12/postgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password/" data-a2a-title="PostgreSQL: pg_ident.conf to map Operating System Username and Database Username"></a></p><p>If you do not know about the role of pg_hba.conf file, visit the below link.</p>
<blockquote class="wp-embedded-content" data-secret="JrH3IqJXlV"><p><a href="https://www.dbrnd.com/2016/01/postgresql-how-to-allow-remote-connection-to-connect-database/">PostgreSQL: How to Allow Remote Connection to Connect Database</a></p></blockquote>
<p><iframe class="wp-embedded-content" sandbox="allow-scripts" security="restricted"  src="https://www.dbrnd.com/2016/01/postgresql-how-to-allow-remote-connection-to-connect-database/embed/#?secret=JrH3IqJXlV" data-secret="JrH3IqJXlV" width="600" height="338" title="&#8220;PostgreSQL: How to Allow Remote Connection to Connect Database&#8221; &#8212; Database Research &amp; Development" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe></p>
<blockquote><p>PostgreSQL also has a one more file related user access permission and that is pg_ident.conf.<br />
PostgreSQL provides Ident-based authentication and It works by obtaining the client&#8217;s operating system user name and using it as the allowed database user name with an optional user name mapping.</p></blockquote>
<blockquote><p>When we are using an external authentication system, system username might not be the same as database username. </p></blockquote>
<blockquote><p>To allow external authentication, We should map the system username with database username and we can also set a map name to hide the system username and database username related detail.</p></blockquote>
<p>For example, </p>
<p><strong>Go to the PostgreSQL data directory and Open pg_ident.conf file.</strong><br />
<strong>You can find below lines:</strong></p>
<pre class="crayon-plain-tag"># Put your actual configuration here
# ----------------------------------
# MAPNAME       SYSTEM-USERNAME         PG-USERNAME</pre> </p>
<p><strong>You can add value to map system username and database username:</strong></p>
<pre class="crayon-plain-tag"># Put your actual configuration here
# ----------------------------------
# MAPNAME       SYSTEM-USERNAME         PG-USERNAME
User123         LinuxUser               PGUser</pre> </p>
<blockquote><p>Once you map your system user and database user in pg_ident.conf file, you can use map name in pg_hba.conf file to allow external authentication.</p></blockquote>
<p><strong>Go to your PostgreSQL data directory and open a pg_hba.conf file.</strong></p>
<p>You can add the map name of system user and database user in METHOD column.<br />
For Example, </p>
<pre class="crayon-plain-tag"># TYPE  DATABASE        USER            ADDRESS                 METHOD
host    all             all             120.172.0.0/16          ident map=User123</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2016/12/postgresql-pg_ident-conf-to-map-operating-system-username-and-database-username-external-authentication-password/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>SQL Server: Script to grant EXECUTE stored procedure permission to a Database USER</title>
		<link>https://www.dbrnd.com/2016/11/sql-server-script-to-grant-execute-stored-procedure-permission-to-a-database-user/</link>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Wed, 09 Nov 2016 16:16:55 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[SQL Server DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[EXECUTE]]></category>
		<category><![CDATA[permission]]></category>
		<category><![CDATA[SQL Query]]></category>
		<category><![CDATA[SQL Server Administrator]]></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>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=1964</guid>

					<description><![CDATA[In this post, I am sharing one permission script to assign EXECUTE permission to the SQL Server Database User. Generally, we are creating separate read only database user with limited access. We are assigning only SELECT permission on some the tables and views for a particular read only database user. But sometimes, this user also [&#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%2F11%2Fsql-server-script-to-grant-execute-stored-procedure-permission-to-a-database-user%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20grant%20EXECUTE%20stored%20procedure%20permission%20to%20a%20Database%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%2F2016%2F11%2Fsql-server-script-to-grant-execute-stored-procedure-permission-to-a-database-user%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20grant%20EXECUTE%20stored%20procedure%20permission%20to%20a%20Database%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%2F2016%2F11%2Fsql-server-script-to-grant-execute-stored-procedure-permission-to-a-database-user%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20grant%20EXECUTE%20stored%20procedure%20permission%20to%20a%20Database%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%2F2016%2F11%2Fsql-server-script-to-grant-execute-stored-procedure-permission-to-a-database-user%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20grant%20EXECUTE%20stored%20procedure%20permission%20to%20a%20Database%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%2F2016%2F11%2Fsql-server-script-to-grant-execute-stored-procedure-permission-to-a-database-user%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20grant%20EXECUTE%20stored%20procedure%20permission%20to%20a%20Database%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%2F2016%2F11%2Fsql-server-script-to-grant-execute-stored-procedure-permission-to-a-database-user%2F&amp;linkname=SQL%20Server%3A%20Script%20to%20grant%20EXECUTE%20stored%20procedure%20permission%20to%20a%20Database%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%2F2016%2F11%2Fsql-server-script-to-grant-execute-stored-procedure-permission-to-a-database-user%2F&#038;title=SQL%20Server%3A%20Script%20to%20grant%20EXECUTE%20stored%20procedure%20permission%20to%20a%20Database%20USER" data-a2a-url="https://www.dbrnd.com/2016/11/sql-server-script-to-grant-execute-stored-procedure-permission-to-a-database-user/" data-a2a-title="SQL Server: Script to grant EXECUTE stored procedure permission to a Database USER"></a></p><p>In this post, I am sharing one permission script to assign EXECUTE permission to the SQL Server Database User.</p>
<p>Generally, we are creating separate read only database user with limited access. </p>
<p>We are assigning only SELECT permission on some the tables and views for a particular read only database user.<br />
But sometimes, this user also require to EXECUTE all stored procedures or a particular stored procedure. </p>
<p><strong>Create a new database role and assign EXECUTE permission:</strong></p>
<pre class="crayon-plain-tag">CREATE ROLE SP_Executor
GO
GRANT EXECUTE TO SP_Executor
GO</pre> </p>
<p><strong>Create database user and assign this role to it:</strong></p>
<pre class="crayon-plain-tag">CREATE USER dbrnd FOR LOGIN Database_Readonly_User
GO
EXEC sp_addrolemember N'SP_Executor', N'dbrnd'
GO</pre> </p>
<p><strong>Assign EXECUTE permission for a particular stored procedure:</strong></p><pre class="crayon-plain-tag">GRANT EXECUTE ON [usp_MyStoredProcedure] TO dbrnd</pre><p> </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: Script to Create a Read-Only Database User</title>
		<link>https://www.dbrnd.com/2015/10/postgresql-script-to-create-a-read-only-database-user/</link>
					<comments>https://www.dbrnd.com/2015/10/postgresql-script-to-create-a-read-only-database-user/#comments</comments>
		
		<dc:creator><![CDATA[Anvesh Patel]]></dc:creator>
		<pubDate>Thu, 22 Oct 2015 16:20:45 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[PostgreSQL DBA Script]]></category>
		<category><![CDATA[Anvesh Patel]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database research and development]]></category>
		<category><![CDATA[dbrnd]]></category>
		<category><![CDATA[permission]]></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[PostgreSQL Tuning]]></category>
		<category><![CDATA[role]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[user]]></category>
		<guid isPermaLink="false">https://www.dbrnd.com/?p=911</guid>

					<description><![CDATA[In this post, I am sharing the help on how to create, a read-only user with limited access in PostgreSQL Database Server?. As a Database Administrator, you should create different database users for the different purposes. In the standard application, there are a few various types of Database Users like Application user, Read-only user, Admin [&#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%2F10%2Fpostgresql-script-to-create-a-read-only-database-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20Create%20a%20Read-Only%20Database%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%2F2015%2F10%2Fpostgresql-script-to-create-a-read-only-database-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20Create%20a%20Read-Only%20Database%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%2F2015%2F10%2Fpostgresql-script-to-create-a-read-only-database-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20Create%20a%20Read-Only%20Database%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%2F2015%2F10%2Fpostgresql-script-to-create-a-read-only-database-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20Create%20a%20Read-Only%20Database%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%2F2015%2F10%2Fpostgresql-script-to-create-a-read-only-database-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20Create%20a%20Read-Only%20Database%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%2F2015%2F10%2Fpostgresql-script-to-create-a-read-only-database-user%2F&amp;linkname=PostgreSQL%3A%20Script%20to%20Create%20a%20Read-Only%20Database%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%2F2015%2F10%2Fpostgresql-script-to-create-a-read-only-database-user%2F&#038;title=PostgreSQL%3A%20Script%20to%20Create%20a%20Read-Only%20Database%20User" data-a2a-url="https://www.dbrnd.com/2015/10/postgresql-script-to-create-a-read-only-database-user/" data-a2a-title="PostgreSQL: Script to Create a Read-Only Database User"></a></p><p>In this post, I am sharing the help on how to create, a read-only user with limited access in PostgreSQL Database Server?.</p>
<p>As a Database Administrator, you should create different database users for the different purposes.<br />
In the standard application, there are a few various types of Database Users like Application user, Read-only user, Admin user.</p>
<p><strong>You should always create a shared database role group and assign roles to the user. </strong></p>
<p>Here, I am sharing one script to create the read only user with limited access to PostgreSQL Database. This user can only SELECT table data and also restricted by schema access. </p>
<p><strong>Create the Read-Only user:</strong></p>
<pre class="crayon-plain-tag">CREATE ROLE Read_Only_User WITH LOGIN PASSWORD 'Test1234' 
NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION VALID UNTIL 'infinity';</pre> </p>
<p><strong>Assign permissions to the read only user:</strong></p>
<pre class="crayon-plain-tag">GRANT CONNECT ON DATABASE YourDatabaseName TO Read_Only_User;
GRANT USAGE ON SCHEMA public TO Read_Only_User;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO Read_Only_User;
GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO Read_Only_User;</pre> </p>
<p>In the above script, you can find that I restricted user by Database, Schema and gave only SELECT permission for tables. </p>
<p><strong>If you need to give any additional permission like EXECUTE permission for functions, use below script. </strong></p>
<pre class="crayon-plain-tag">GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO Read_Only_User;</pre> </p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.dbrnd.com/2015/10/postgresql-script-to-create-a-read-only-database-user/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
	</channel>
</rss>
