iredmail-doc/html/sql.mark.user.as.admin.html

71 lines
3.7 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SQL: Mark existing mail user as global domain admin</title>
<link rel="stylesheet" type="text/css" href="./css/markdown.css" />
</head>
<body>
<div id="navigation">
<a href="http://www.iredmail.org" target="_blank"><img alt="iRedMail web site" src="images/logo-iredmail.png" style="vertical-align: middle; height: 30px;"/> <span>iRedMail</span></a>
// <a href="./index.html">Document Index</a>
</div><h1 id="sql-mark-existing-mail-user-as-global-domain-admin">SQL: Mark existing mail user as global domain admin</h1>
<div class="toc">
<ul>
<li><a href="#sql-mark-existing-mail-user-as-global-domain-admin">SQL: Mark existing mail user as global domain admin</a><ul>
<li><a href="#mark-user-as-global-domain-admin-with-iredadmin-pro">Mark user as global domain admin with iRedAdmin-Pro</a></li>
<li><a href="#mark-user-as-global-domain-admin-with-sql-command-line-tool">Mark user as global domain admin with SQL command line tool</a></li>
</ul>
</li>
</ul>
</div>
<h3 id="mark-user-as-global-domain-admin-with-iredadmin-pro">Mark user as global domain admin with iRedAdmin-Pro</h3>
<p>With iRedAdmin-Pro, you can mark user as either global domain admin or normal
domain admin in user profile page, under tab <code>General</code>.</p>
<p><img alt="" src="../images/iredadmin/user_profile_general.png" /></p>
<h3 id="mark-user-as-global-domain-admin-with-sql-command-line-tool">Mark user as global domain admin with SQL command line tool</h3>
<blockquote>
<p>If you don't have any mail account, please follow this tutorial to create a
new mail user: <a href="./sql.bulk.create.mail.users.html">SQL: Bulk create mail users</a>.</p>
</blockquote>
<p>Let's say you want to mark existing user <code>user@mydomain.com</code> as global domain
admin, please follow steps below to achieve this.</p>
<ul>
<li>
<p>Login to SQL server as either SQL root user or <code>vmailadmin</code> user.</p>
<ul>
<li>
<p>About SQL root user:</p>
<ul>
<li>for MySQL or MariaDB: SQL root user is <code>root</code>.</li>
<li>for PostgreSQL: it's system account <code>postgres</code> on Linux, or
<code>postgresql</code> on FreeBSD, or <code>_pgsql</code> on OpenBSD.</li>
</ul>
</li>
<li>
<p>You can find their passwords in file <code>iRedMail.tips</code> under iRedMail
installation directory. for example, <code>/root/iRedMail-0.9.3/iRedMail.tips</code>.</p>
</li>
</ul>
</li>
<li>
<p>Update SQL table <code>vmail.mailbox</code> and <code>vmail.domain_admins</code> to mark this user
as global domain admin:</p>
</li>
</ul>
<pre><code>sql&gt; UPDATE mailbox SET isadmin=1,isglobaladmin=1 WHERE username='user@mydomain.com';
sql&gt; INSERT INTO domain_admins (username, domain) VALUES ('user@mydomain.com', 'ALL');
</code></pre>
<p>Now you can login to iRedAdmin-Pro as <code>user@mydomain.com</code>, it's global domain
admin.</p><p style="text-align: center; color: grey;">All documents are available in <a href="https://bitbucket.org/zhb/iredmail-docs/src">BitBucket repository</a>, and published under <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">Creative Commons</a> license. If you found something wrong, please do <a href="http://www.iredmail.org/contact.html">contact us</a> to fix it.<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-3293801-21', 'auto');
ga('send', 'pageview');
</script>
</body></html>