{"id":892,"date":"2016-02-22T14:43:45","date_gmt":"2016-02-22T12:43:45","guid":{"rendered":"http:\/\/www.netexpertise.eu\/en\/?p=892"},"modified":"2021-08-23T09:08:43","modified_gmt":"2021-08-23T07:08:43","slug":"as400-mass-object-owner-change","status":"publish","type":"post","link":"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html","title":{"rendered":"AS400 Mass Object Owner Change"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Change Owner Through IBM i Terminal<\/h3>\n\n\n\n<p>There are many ways to change an object owner on IBM i. With CHGOBJOWN for a single object, or WRKOBJOWN then press 9 for each object if you want to start with all objects belonging to somebody.<br>Changing ownership of thousands of objects this way will be very painful and time consuming!<br>&nbsp;<br>Specialised websites like <a href=\"http:\/\/www.itjungle.com\/fhg\/fhg012506-story03.html\" target=\"_blank\" rel=\"noreferrer noopener\">itjungle<\/a> suggest quicker ways like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">CHGOWN OBJ('\/qsys.lib\/mylib.lib\/*.*') NEWOWN(new_owner) RVKOLDAUT(*YES)<\/code><\/pre>\n\n\n\n<p>which is a good way to change the owner of all objects within the same library.<br>&nbsp;<br>But there is more powerful if you&#8217;re not against using QSHELL or PASE (run QSH or CALL QP2TERM), or connect with <a href=\"\/en\/AS400\/ssh-default-shell-and-command-history-on-as400.html\">SSH<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><br>Advanced Ownership Commands in QSH\/PASE<\/h3>\n\n\n\n<p>You can move into the library&#8217;s directory with cd. Always append .LIB to your library<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">cd \/QSYS.LIB\/MYLIB.LIB<\/code><\/pre>\n\n\n\n<p>&nbsp;<br>You can easily count the number of objects:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ls -1 | wc -l\n    6228<\/code><\/pre>\n\n\n\n<p>&nbsp;<br>Display all objects owner with <em>ls<\/em> and <em>more<\/em> to display one page at a time (can be slow if loads of objects)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ ls -l | more\ntotal 190672\ndrwx---rwx    2 owner    0             28672 Jan  5 10:37 $BUL100.FILE\ndrwx---rwx    2 owner    0             20480 Jan  5 10:37 $BUL200.FILE\n[...]<\/code><\/pre>\n\n\n\n<p>&nbsp;<br>Change owner for all objects is as easy as:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">chown new_owner *.*<\/code><\/pre>\n\n\n\n<p>You can also be more specific with *.FILE or MY_*.PRG.<br>&nbsp;<br>And this is where it gets interesting. You can change all objects that have no owner<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">find . -nouser | xargs chown newowner<\/code><\/pre>\n\n\n\n<p>Use with care, read on&#8230;<br>&nbsp;<br>You can also change all objects belonging to somebody in particular<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">find . -user oldowner | xargs chown new owner<\/code><\/pre>\n\n\n\n<p>These commands can save you a lot of time!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><br>AS400 Username Length and Other Tips<\/h3>\n\n\n\n<p><em>find<\/em> will also search in subdirectories.<br>&nbsp;<br>You may get an unknown username error:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ chown lgusername AABL01WC.PGM\nchown: lgusername is an unknown username.<\/code><\/pre>\n\n\n\n<p>You need to get the user id in his profile and use that number instead, if the username length is greater than 8 characters:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ chown 1073 AABL01WC.PGM<\/code><\/pre>\n\n\n\n<p>See that <a href=\"http:\/\/www-01.ibm.com\/support\/docview.wss?uid=nas8N1013998\" target=\"_blank\" rel=\"noreferrer noopener\">note<\/a> from IBM. You&#8217;re better off setting all usernames with 8 characters or less in iSeries.<br>&nbsp;<br>Knowing the username length problem, the command &#8220;find . -nouser&#8221; will also return files\/objects belonging to 9 or 10 character long profiles! Shame IBM didn&#8217;t set the username max length to 10 as well in PASE.<br>&nbsp;<br>One last piece of advice: connect via <a href=\"\/en\/AS400\/ssh-default-shell-and-command-history-on-as400.html\">SSH<\/a> for a bigger terminal window.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Change Owner Through IBM i Terminal There are many ways to change an object owner on IBM i. With CHGOBJOWN for a single object, or WRKOBJOWN then press 9 for each object if you want to start with all objects belonging to somebody.Changing ownership of thousands of objects this way will be very painful and [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[210],"tags":[396,405,230],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Netexpertise - AS400 Mass Object Owner Change<\/title>\n<meta name=\"description\" content=\"Change ownership of thousands of AS400 objects in a single command, objects with no owner, objects belonging to someone, and more ...\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Netexpertise - AS400 Mass Object Owner Change\" \/>\n<meta property=\"og:description\" content=\"Change ownership of thousands of AS400 objects in a single command, objects with no owner, objects belonging to someone, and more ...\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html\" \/>\n<meta property=\"og:site_name\" content=\"Netexpertise\" \/>\n<meta property=\"article:published_time\" content=\"2016-02-22T12:43:45+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-08-23T07:08:43+00:00\" \/>\n<meta name=\"author\" content=\"dave\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@netexpertise\" \/>\n<meta name=\"twitter:site\" content=\"@netexpertise\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html\",\"url\":\"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html\",\"name\":\"Netexpertise - AS400 Mass Object Owner Change\",\"isPartOf\":{\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#website\"},\"datePublished\":\"2016-02-22T12:43:45+00:00\",\"dateModified\":\"2021-08-23T07:08:43+00:00\",\"author\":{\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa\"},\"description\":\"Change ownership of thousands of AS400 objects in a single command, objects with no owner, objects belonging to someone, and more ...\",\"breadcrumb\":{\"@id\":\"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/www.netexpertise.eu\/en\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AS400 Mass Object Owner Change\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#website\",\"url\":\"http:\/\/www.netexpertise.eu\/en\/\",\"name\":\"Netexpertise\",\"description\":\"Systems \/ Networks \/ DevOps\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/www.netexpertise.eu\/en\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa\",\"name\":\"dave\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g\",\"caption\":\"dave\"},\"sameAs\":[\"http:\/\/www.netexpertise.eu\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Netexpertise - AS400 Mass Object Owner Change","description":"Change ownership of thousands of AS400 objects in a single command, objects with no owner, objects belonging to someone, and more ...","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html","og_locale":"en_US","og_type":"article","og_title":"Netexpertise - AS400 Mass Object Owner Change","og_description":"Change ownership of thousands of AS400 objects in a single command, objects with no owner, objects belonging to someone, and more ...","og_url":"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html","og_site_name":"Netexpertise","article_published_time":"2016-02-22T12:43:45+00:00","article_modified_time":"2021-08-23T07:08:43+00:00","author":"dave","twitter_card":"summary_large_image","twitter_creator":"@netexpertise","twitter_site":"@netexpertise","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html","url":"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html","name":"Netexpertise - AS400 Mass Object Owner Change","isPartOf":{"@id":"http:\/\/www.netexpertise.eu\/en\/#website"},"datePublished":"2016-02-22T12:43:45+00:00","dateModified":"2021-08-23T07:08:43+00:00","author":{"@id":"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa"},"description":"Change ownership of thousands of AS400 objects in a single command, objects with no owner, objects belonging to someone, and more ...","breadcrumb":{"@id":"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html"]}]},{"@type":"BreadcrumbList","@id":"http:\/\/www.netexpertise.eu\/en\/systems\/as400\/as400-mass-object-owner-change.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.netexpertise.eu\/en"},{"@type":"ListItem","position":2,"name":"AS400 Mass Object Owner Change"}]},{"@type":"WebSite","@id":"http:\/\/www.netexpertise.eu\/en\/#website","url":"http:\/\/www.netexpertise.eu\/en\/","name":"Netexpertise","description":"Systems \/ Networks \/ DevOps","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.netexpertise.eu\/en\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/cb4cd666549d22e9070ec1cfc1a496fa","name":"dave","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.netexpertise.eu\/en\/#\/schema\/person\/image\/","url":"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g","contentUrl":"http:\/\/1.gravatar.com\/avatar\/1129916e1f4955bd632f27f836f64e55?s=96&d=mm&r=g","caption":"dave"},"sameAs":["http:\/\/www.netexpertise.eu"]}]}},"_links":{"self":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts\/892"}],"collection":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/comments?post=892"}],"version-history":[{"count":0,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/posts\/892\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/media?parent=892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/categories?post=892"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.netexpertise.eu\/en\/wp-json\/wp\/v2\/tags?post=892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}