<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Changing UID/GID in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777891#M76516</link>
    <description>&lt;BR /&gt;Safe? Sure. Just don't mess with system accounts.&lt;BR /&gt;&lt;BR /&gt;Caution: I have not performed this procedure. Experts, please advise.&lt;BR /&gt;&lt;BR /&gt;Make a backup of /etc/passwd and /etc/group.&lt;BR /&gt;Make a backup of the entire system.&lt;BR /&gt;&lt;BR /&gt;Do this in single user mode with all necessary filesystems mounted.&lt;BR /&gt;&lt;BR /&gt;Create an ownwership manifest of files in all shared directories. (See attached PERL script.) Avoid system and top level directories.&lt;BR /&gt;&lt;BR /&gt;find /dir1 /dir2 -xdev | manifest.pl &amp;gt; manifest.out&lt;BR /&gt;&lt;BR /&gt;Do not modify /etc/passwd directly. Use the usermod utility as it will modify the ownership of home directories automatically.&lt;BR /&gt;&lt;BR /&gt;Using a new passwd-formatted file of ONLY changed user accounts as input:&lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;# one-by-one, change users' id numbers&lt;BR /&gt;while IFS=':' read name pw uid junk&lt;BR /&gt;do&lt;BR /&gt;#change user's uid&lt;BR /&gt;if usermod -u $uid -o $name&lt;BR /&gt;then&lt;BR /&gt;# recursive update of home directory&lt;BR /&gt;# and mail spool ownership, for good measure.&lt;BR /&gt;# the eval correctly resolves ~$name&lt;BR /&gt;eval chown -hR $name ~$name /var/mail/$name&lt;BR /&gt;fi&lt;BR /&gt;done &amp;lt; new-passwd-file&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The -o option to usermod accounts for the likely overlap of userid numbers during the run.&lt;BR /&gt;&lt;BR /&gt;The -h option to chown will modify ownership&lt;BR /&gt;of symbolic links, not the target files.&lt;BR /&gt;&lt;BR /&gt;Now update ownership of all files in the previously created manifest:&lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;while read name file&lt;BR /&gt;do&lt;BR /&gt;chown -h $name "$file"&lt;BR /&gt;done &amp;lt; manifest.out&lt;BR /&gt;&lt;BR /&gt;To verify, create a new manifest and compare.&lt;BR /&gt;&lt;BR /&gt;Did I miss anything?</description>
    <pubDate>Thu, 01 Aug 2002 19:32:03 GMT</pubDate>
    <dc:creator>Jordan Bean</dc:creator>
    <dc:date>2002-08-01T19:32:03Z</dc:date>
    <item>
      <title>Changing UID/GID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777886#M76511</link>
      <description>Hello All,&lt;BR /&gt;&lt;BR /&gt;I am in the process of planning a re-alignment of UIDs &amp;amp; GIDs of non administrative and non system users. I have these questions:&lt;BR /&gt;&lt;BR /&gt;1. Is UID/GID re-alignment a "safe" change to do? i.e can it be done successfully without compromising the system?&lt;BR /&gt;&lt;BR /&gt;2. After using SAM to change the UID of a user, I find that there are still some files and links with the old UID in the system. How can I also change soft links without changing the UID of the target it is pointing to using find?&lt;BR /&gt;&lt;BR /&gt;3. Does anyone have a good ideas and suggestions to do this change?&lt;BR /&gt;&lt;BR /&gt;All replies are appreciated. Thank you.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Suren Selva&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Aug 2002 17:42:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777886#M76511</guid>
      <dc:creator>Suren Selva</dc:creator>
      <dc:date>2002-08-01T17:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Changing UID/GID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777887#M76512</link>
      <description>Suren,&lt;BR /&gt;&lt;BR /&gt;If you have lots of users, you better save the original /etc/passwd and /etc/group just in case.&lt;BR /&gt;&lt;BR /&gt;Hai</description>
      <pubDate>Thu, 01 Aug 2002 17:48:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777887#M76512</guid>
      <dc:creator>Hai Nguyen_1</dc:creator>
      <dc:date>2002-08-01T17:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: Changing UID/GID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777888#M76513</link>
      <description>One more thing I have just thougt of is doing this in single user mode and then bringing up the system to multi-user mode for system consistency in term of changes in uid, gid.&lt;BR /&gt;&lt;BR /&gt;Hai</description>
      <pubDate>Thu, 01 Aug 2002 17:51:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777888#M76513</guid>
      <dc:creator>Hai Nguyen_1</dc:creator>
      <dc:date>2002-08-01T17:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Changing UID/GID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777889#M76514</link>
      <description>Hi&lt;BR /&gt;To change the symbolic links&lt;BR /&gt;&lt;BR /&gt;find . -type l -user xxx -exec chown -h yyy {} \;</description>
      <pubDate>Thu, 01 Aug 2002 18:12:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777889#M76514</guid>
      <dc:creator>Leif Halvarsson_2</dc:creator>
      <dc:date>2002-08-01T18:12:09Z</dc:date>
    </item>
    <item>
      <title>Re: Changing UID/GID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777890#M76515</link>
      <description>I would script this if at all possible.  First you will need to identify which accounts will change.  Then take one account at a time.  Find all the files owned by that user and place the list in a temporary file.  Next change the UID and then go back and change all the files that are owned by the old UID to the new UID (done with a loop on the list).  You will have problems with the symbolic links because they will not change.  You can either ignore this or remove and create the link again with the new UID.&lt;BR /&gt;&lt;BR /&gt;Now your question on this all being safe.  I would not do this on a server that is being used.  Do this while the users are all tucked in and sleeping sound.  This is also not very fun on large servers where the find itself will take close to an hour.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.</description>
      <pubDate>Thu, 01 Aug 2002 18:12:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777890#M76515</guid>
      <dc:creator>Daimian Woznick</dc:creator>
      <dc:date>2002-08-01T18:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Changing UID/GID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777891#M76516</link>
      <description>&lt;BR /&gt;Safe? Sure. Just don't mess with system accounts.&lt;BR /&gt;&lt;BR /&gt;Caution: I have not performed this procedure. Experts, please advise.&lt;BR /&gt;&lt;BR /&gt;Make a backup of /etc/passwd and /etc/group.&lt;BR /&gt;Make a backup of the entire system.&lt;BR /&gt;&lt;BR /&gt;Do this in single user mode with all necessary filesystems mounted.&lt;BR /&gt;&lt;BR /&gt;Create an ownwership manifest of files in all shared directories. (See attached PERL script.) Avoid system and top level directories.&lt;BR /&gt;&lt;BR /&gt;find /dir1 /dir2 -xdev | manifest.pl &amp;gt; manifest.out&lt;BR /&gt;&lt;BR /&gt;Do not modify /etc/passwd directly. Use the usermod utility as it will modify the ownership of home directories automatically.&lt;BR /&gt;&lt;BR /&gt;Using a new passwd-formatted file of ONLY changed user accounts as input:&lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;# one-by-one, change users' id numbers&lt;BR /&gt;while IFS=':' read name pw uid junk&lt;BR /&gt;do&lt;BR /&gt;#change user's uid&lt;BR /&gt;if usermod -u $uid -o $name&lt;BR /&gt;then&lt;BR /&gt;# recursive update of home directory&lt;BR /&gt;# and mail spool ownership, for good measure.&lt;BR /&gt;# the eval correctly resolves ~$name&lt;BR /&gt;eval chown -hR $name ~$name /var/mail/$name&lt;BR /&gt;fi&lt;BR /&gt;done &amp;lt; new-passwd-file&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The -o option to usermod accounts for the likely overlap of userid numbers during the run.&lt;BR /&gt;&lt;BR /&gt;The -h option to chown will modify ownership&lt;BR /&gt;of symbolic links, not the target files.&lt;BR /&gt;&lt;BR /&gt;Now update ownership of all files in the previously created manifest:&lt;BR /&gt;&lt;BR /&gt;#!/sbin/sh&lt;BR /&gt;while read name file&lt;BR /&gt;do&lt;BR /&gt;chown -h $name "$file"&lt;BR /&gt;done &amp;lt; manifest.out&lt;BR /&gt;&lt;BR /&gt;To verify, create a new manifest and compare.&lt;BR /&gt;&lt;BR /&gt;Did I miss anything?</description>
      <pubDate>Thu, 01 Aug 2002 19:32:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777891#M76516</guid>
      <dc:creator>Jordan Bean</dc:creator>
      <dc:date>2002-08-01T19:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: Changing UID/GID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777892#M76517</link>
      <description>I changed a uid using SAM. SAM did not change the uid of all the files owned by the user. It left some of the users files with the old uid. Does anyone know why it does that?&lt;BR /&gt;&lt;BR /&gt;SAM also left some softlinks with the old uid. The samlog_viewer showed chown being used instead of chown -h. This means that if the links are owned by the user, the links themselves won't be changed, but the target the links point to will be changed even if they are NOT owned by the user. Suppose user peterj has a link called peterlink that points to target /sbin/init, the ownership of peterlink will not change but /sbin/init will. Isn't this dangerous? Any opinions? Thanks.&lt;BR /&gt;&lt;BR /&gt;Suren</description>
      <pubDate>Thu, 01 Aug 2002 20:38:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777892#M76517</guid>
      <dc:creator>Suren Selva</dc:creator>
      <dc:date>2002-08-01T20:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Changing UID/GID</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777893#M76518</link>
      <description>I agree that this is rather messy, and isn't&lt;BR /&gt;something I'd likely do on a system without&lt;BR /&gt;some really compelling reason.  In addition to things already mentioned, keep in mind&lt;BR /&gt;that&lt;BR /&gt;&lt;BR /&gt;1) you may have to do similar changes on&lt;BR /&gt;   other systems if you share files with NFS,&lt;BR /&gt;   use NIS for passwd file management, etc.&lt;BR /&gt;&lt;BR /&gt;2) The maximum value of a uid varies between HP-UX releases.  If you have a mix of newer&lt;BR /&gt;and older releases AND try to use large&lt;BR /&gt;uids, you could wind up with a situation&lt;BR /&gt;like this where the uid is silently truncated:&lt;BR /&gt;&lt;BR /&gt;# touch /tmp/foo&lt;BR /&gt;# chown 1234567 /tmp/foo&lt;BR /&gt;# ll /tmp/foo&lt;BR /&gt;-rw-rw-rw-   1 54919    sys            0 Aug  2 09:59 /tmp/foo&lt;BR /&gt;# &lt;BR /&gt;&lt;BR /&gt;(54919 is 1234567 modulo 65536)&lt;BR /&gt;&lt;BR /&gt;If I remember correctly, HP-UX 10.20 was the&lt;BR /&gt;first release to support 32-bit uids.&lt;BR /&gt;&lt;BR /&gt;Even on newer HP-UX releases you can't always use the full 32 bits of uid.  See the edquota manual page for restrictions.  Usually this isn't an issue but you wouldn't want to be surprised by this during/after a long conversion!&lt;BR /&gt;&lt;BR /&gt;3) There can be 'hidden' uids.  For example, if you have something in 'ar' format, the saved&lt;BR /&gt;uid/gid of the files in the archive won't be&lt;BR /&gt;changed by your chown.  Depending on which&lt;BR /&gt;backup utilities you use, there could be similar problems with restoring backup tapes&lt;BR /&gt;&lt;BR /&gt;4) HP-UX thinks it owns the low-numbered&lt;BR /&gt;uids and gids.  Please reserve (at least)&lt;BR /&gt;the first 100 or so uids for system accounts&lt;BR /&gt;like bin, lp, adm, etc. and don't change&lt;BR /&gt;the values of the existing system IDs.&lt;BR /&gt;&lt;BR /&gt;There are probably other issues, but these&lt;BR /&gt;come to mind as things you would want to&lt;BR /&gt;consider before attempting such a conversion.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 02 Aug 2002 16:12:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/changing-uid-gid/m-p/2777893#M76518</guid>
      <dc:creator>doug hosking</dc:creator>
      <dc:date>2002-08-02T16:12:46Z</dc:date>
    </item>
  </channel>
</rss>

