{"id":5220,"date":"2024-08-26T10:00:00","date_gmt":"2024-08-26T10:00:00","guid":{"rendered":"https:\/\/netguide.io\/linux\/linux-find-out-display-puid-and-pgid\/"},"modified":"2024-08-26T10:00:00","modified_gmt":"2024-08-26T10:00:00","slug":"linux-find-out-display-puid-and-pgid","status":"publish","type":"post","link":"https:\/\/netguide.io\/linux\/en\/linux-find-out-display-puid-and-pgid\/","title":{"rendered":"Linux: Find out \/ display PUID and PGID"},"content":{"rendered":"<script type=\"text\/plain\" data-tcf=\"waiting-for-consent\" data-id=\"4797\" data-bid=\"2\" data-placement=\"4798\">PGRpdiBpZD0ibmV0Z3VpZGVhLTExMDg2MjczODkiIGNsYXNzPSJuZXRndWlkZWEtYmVmb3JlLWNvbnRlbnQgbmV0Z3VpZGVhLWVudGl0eS1wbGFjZW1lbnQiPjxkaXYgY2xhc3M9Im5ldGd1aWRlYS1hZGxhYmVsIj5BZHZlcnRpc2VtZW50czwvZGl2PjxzY3JpcHQgYXN5bmMgc3JjPSIvL3BhZ2VhZDIuZ29vZ2xlc3luZGljYXRpb24uY29tL3BhZ2VhZC9qcy9hZHNieWdvb2dsZS5qcz9jbGllbnQ9Y2EtcHViLTYyNTg1NTYyNTcyNDU5OTgiIGNyb3Nzb3JpZ2luPSJhbm9ueW1vdXMiPjwvc2NyaXB0PjxpbnMgY2xhc3M9ImFkc2J5Z29vZ2xlIiBzdHlsZT0iZGlzcGxheTpibG9jazsiIGRhdGEtYWQtY2xpZW50PSJjYS1wdWItNjI1ODU1NjI1NzI0NTk5OCIgCmRhdGEtYWQtc2xvdD0iMzQ5NDExNTM0MiIgCmRhdGEtYWQtZm9ybWF0PSJhdXRvIj48L2lucz4KPHNjcmlwdD4gCihhZHNieWdvb2dsZSA9IHdpbmRvdy5hZHNieWdvb2dsZSB8fCBbXSkucHVzaCh7fSk7IAo8L3NjcmlwdD4KPC9kaXY+<\/script>\n<p class=\"wp-block-paragraph\">The PUID and PGID can be relevant for NFS shares and Docker containers. To determine the PUID (User ID) and PGID (Group ID) of the user under which Docker is running on a Linux system, proceed as follows:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Find out the user name of the Docker process<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">First you need to find out the user name of the process under which Docker is running. You can do this with the following command:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\"><pre class=\"shiki\" tabindex=\"0\" data-language=\"shell\"><code>ps aux | grep dockerd<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">This command lists all processes related to <code>dockerd<\/code>. In the output, you will see a column indicating the user name under which the Docker daemon is running. This is normally <code>root<\/code>, but it can also be another user if Docker has been set up with special permissions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. Determine the user ID (PUID) and group ID (PGID)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Once you know the user name, you can find out the PUID and PGID with the following command:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\"><pre class=\"shiki\" tabindex=\"0\" data-language=\"shell\"><code>id &lt;username&gt;<\/code><\/pre><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Replace <code>&lt;username&gt;<\/code> with the actual user name you found in the previous step.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example: if Docker is running as <code>root<\/code>, enter:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\"><pre class=\"shiki\" tabindex=\"0\" data-language=\"shell\"><code>id root<\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">3. Understanding the output<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The output of the <code>id<\/code> command looks something like this:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\"><pre class=\"shiki\" tabindex=\"0\" data-language=\"text\"><code>uid=0(root) gid=0(root) groups=0(root)<\/code><\/pre><\/div>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>PUID<\/strong> (User ID) is the number after <code>uid=<\/code>.<\/li>\n\n\n\n<li><strong>PGID<\/strong> (Group ID) is the number after <code>gid=<\/code>.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">In this example, both the PUID and the PGID are <code>0<\/code>, which is typical for the <code>root<\/code> user.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Summary<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Find the user name under which Docker is running with <code>ps aux | grep dockerd<\/code>.<\/li>\n\n\n\n<li>Find out the PUID and PGID of this user with <code>id &lt;username&gt;<\/code>.<\/li>\n\n\n\n<li>The PUID is the user ID (<code>uid=<\/code>) and the PGID is the group ID (<code>gid=<\/code>).<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">This information is useful when you start Docker containers and need specific user and group assignments, for example to get file permissions right.<\/p>\n<script type=\"text\/plain\" data-tcf=\"waiting-for-consent\" data-id=\"4799\" data-bid=\"2\" data-placement=\"4800\">PGRpdiBpZD0ibmV0Z3VpZGVhLTgwODQ1OTQ4MSIgY2xhc3M9Im5ldGd1aWRlYS1hZnRlci1jb250ZW50IG5ldGd1aWRlYS1lbnRpdHktcGxhY2VtZW50Ij48ZGl2IGNsYXNzPSJuZXRndWlkZWEtYWRsYWJlbCI+QWR2ZXJ0aXNlbWVudHM8L2Rpdj48c2NyaXB0IGFzeW5jIHNyYz0iLy9wYWdlYWQyLmdvb2dsZXN5bmRpY2F0aW9uLmNvbS9wYWdlYWQvanMvYWRzYnlnb29nbGUuanM\/Y2xpZW50PWNhLXB1Yi02MjU4NTU2MjU3MjQ1OTk4IiBjcm9zc29yaWdpbj0iYW5vbnltb3VzIj48L3NjcmlwdD48aW5zIGNsYXNzPSJhZHNieWdvb2dsZSIgc3R5bGU9ImRpc3BsYXk6YmxvY2s7IiBkYXRhLWFkLWNsaWVudD0iY2EtcHViLTYyNTg1NTYyNTcyNDU5OTgiIApkYXRhLWFkLXNsb3Q9IjQ1NTk3ODUwMDIiIApkYXRhLWFkLWZvcm1hdD0iYXV0byI+PC9pbnM+CjxzY3JpcHQ+IAooYWRzYnlnb29nbGUgPSB3aW5kb3cuYWRzYnlnb29nbGUgfHwgW10pLnB1c2goe30pOyAKPC9zY3JpcHQ+CjwvZGl2Pg==<\/script>","protected":false},"excerpt":{"rendered":"<p>Need the PUID and PGID of the user that runs Docker on Linux? Learn how to find both IDs with ps aux and the id command, and what uid and gid really mean.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_affilinode_tracking":"","_affilinode_autolink_off":false,"_affilinode_rating":"","_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[7],"tags":[],"class_list":["post-5220","post","type-post","status-publish","format-standard","hentry","category-uncategorized-en"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Tobias","author_link":"https:\/\/netguide.io\/linux\/author\/tobias-pries\/"},"uagb_comment_info":0,"uagb_excerpt":"Need the PUID and PGID of the user that runs Docker on Linux? Learn how to find both IDs with ps aux and the id command, and what uid and gid really mean.","brizy_media":[],"_links":{"self":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts\/5220","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/comments?post=5220"}],"version-history":[{"count":0,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/posts\/5220\/revisions"}],"wp:attachment":[{"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/media?parent=5220"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/categories?post=5220"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/netguide.io\/linux\/wp-json\/wp\/v2\/tags?post=5220"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}