{"id":1481,"date":"2025-03-30T14:41:33","date_gmt":"2025-03-30T14:41:33","guid":{"rendered":"https:\/\/www.labiol.xyz\/?p=1481"},"modified":"2025-03-30T14:43:15","modified_gmt":"2025-03-30T14:43:15","slug":"linux-administration-few-interesting-tips","status":"publish","type":"post","link":"https:\/\/www.labiol.xyz\/index.php\/2025\/03\/30\/linux-administration-few-interesting-tips\/","title":{"rendered":"Linux administration, few interesting tips"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Change user id (uid) and group id (gid) for specific user<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>remember current uid, pid for the user you want to do the change<\/li>\n\n\n\n<li>edit \/etc\/passwd file and update uid, gid for the specific user<\/li>\n\n\n\n<li>edit \/etc\/group file and update git<\/li>\n\n\n\n<li>stop all software that is run by the user (logoff user)<\/li>\n\n\n\n<li>find all files that belongs to user and change uid<\/li>\n\n\n\n<li>find all files (and directories) that belongs to user group and change gid<\/li>\n\n\n\n<li>re-login<\/li>\n<\/ol>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-bash\" data-lang=\"Bash\"><code>getent passwd | grep myuser\n#note two numbers (uid, gid)\n#edit passwd, group file and update the old uid, gid to the new one\n\n#find all files with uid (1001 in this example) and change it to 1010, + speed the things up as it sends files in batch\nfind \/ -user 1001  -exec chown 1010 {} +\n#find all files with gid (1001 in this example) and change it to 1010\nfind \/ -group 1001 -exec chown :1010 {} +\n<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Change user id (uid) and group id (gid) for specific user<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1481","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/1481","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/comments?post=1481"}],"version-history":[{"count":4,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/1481\/revisions"}],"predecessor-version":[{"id":1485,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/posts\/1481\/revisions\/1485"}],"wp:attachment":[{"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=1481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=1481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.labiol.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=1481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}