<?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 Are there lock files for passwd/useradd/usermod/userdel ? in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174379#M161718</link>
    <description>We are going to handle some of the these commands with scripts, but we don't want file conflicts, on the off chance someone else is also editing the same login.&lt;BR /&gt;&lt;BR /&gt;I know about /etc/ptmp, but it appears the system does not use it with passwd.  Are there any other lock files the system uses when modifying passwd or shadow?</description>
    <pubDate>Mon, 26 Jan 2004 16:07:25 GMT</pubDate>
    <dc:creator>jmb</dc:creator>
    <dc:date>2004-01-26T16:07:25Z</dc:date>
    <item>
      <title>Are there lock files for passwd/useradd/usermod/userdel ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174379#M161718</link>
      <description>We are going to handle some of the these commands with scripts, but we don't want file conflicts, on the off chance someone else is also editing the same login.&lt;BR /&gt;&lt;BR /&gt;I know about /etc/ptmp, but it appears the system does not use it with passwd.  Are there any other lock files the system uses when modifying passwd or shadow?</description>
      <pubDate>Mon, 26 Jan 2004 16:07:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174379#M161718</guid>
      <dc:creator>jmb</dc:creator>
      <dc:date>2004-01-26T16:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: Are there lock files for passwd/useradd/usermod/userdel ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174380#M161719</link>
      <description>The NIS passwd daemon (yppasswdd) uses /var/adm/ptmp; vipw uses /etc/ptmp and the man page of yppasswd also indicates that vipw uses /var/adm/ptmp as well. The bad news is that all of these are simply conventions. For example, nothing at all would prevent a user with suitable permissions from editing the passwd file with nothing more powerful than vi.</description>
      <pubDate>Mon, 26 Jan 2004 16:14:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174380#M161719</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-01-26T16:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: Are there lock files for passwd/useradd/usermod/userdel ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174381#M161720</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;From the tusc output, I found that it created two files .pwd.lock and ptmp under /etc and use lockf to lock them until it is done.&lt;BR /&gt;&lt;BR /&gt;open("/etc/.pwd.lock", O_RDWR, 0177777) .................... = 3&lt;BR /&gt;lockf(3, 0x2, 0) ........................................... = 0&lt;BR /&gt;open("/etc/ptmp", O_WRONLY|O_CREAT|O_EXCL, 0) .............. = 5&lt;BR /&gt;setresuid(-1, 0, -1) ....................................... = 0&lt;BR /&gt;fchmod(5, 0444) ............................................ = 0&lt;BR /&gt;lockf(5, 0x2, 0) ........................................... = 0&lt;BR /&gt;&lt;BR /&gt;But if you are using only passwd/useradd/usermod commands, then the system will take care of creating the locks. &lt;BR /&gt;&lt;BR /&gt;-Sri&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Jan 2004 16:21:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174381#M161720</guid>
      <dc:creator>Sridhar Bhaskarla</dc:creator>
      <dc:date>2004-01-26T16:21:58Z</dc:date>
    </item>
    <item>
      <title>Re: Are there lock files for passwd/useradd/usermod/userdel ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174382#M161721</link>
      <description>Actually, it appears that all 4 programs do indeed reference /etc/ptmp, so as long as *EVERY* root user is FORBIDDEN to use vi (or ed or sed or emacs or other editors) on the passwd file (or /tcb files), then you'll be OK. A better solution would be to write your scripts with checks to see if another copy is already running. Hint:&lt;BR /&gt; &lt;BR /&gt;MMYNAME=${0##*/}&lt;BR /&gt;if [ UNIX95= ps -C $MYNAME &amp;gt; /dev/null ]&lt;BR /&gt;then&lt;BR /&gt; print "\nAnother copy is running!\n"&lt;BR /&gt; exit 1&lt;BR /&gt;fi</description>
      <pubDate>Mon, 26 Jan 2004 16:26:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174382#M161721</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2004-01-26T16:26:13Z</dc:date>
    </item>
    <item>
      <title>Re: Are there lock files for passwd/useradd/usermod/userdel ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174383#M161722</link>
      <description>vipw is a special version of vi that locks access to the edited file.&lt;BR /&gt;&lt;BR /&gt;Its designed to work on files such as /etc/passwd and such.&lt;BR /&gt;&lt;BR /&gt;It works quite nicely however on any file you don't want edited by another user while you are working on it.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 26 Jan 2004 16:34:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174383#M161722</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2004-01-26T16:34:57Z</dc:date>
    </item>
    <item>
      <title>Re: Are there lock files for passwd/useradd/usermod/userdel ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174384#M161723</link>
      <description>And to second Stephen's vipw recommendation, vipw also uses /etc/ptmp. However, I would discourage root users from using vipw except for minor edits such as the GECOS (information) field. Users can change their own shell without root's help. In fact, it appears that all these tools use /etc/ptmp: &lt;BR /&gt; &lt;BR /&gt;passwd useradd usermod userdel chfn chsh vipw</description>
      <pubDate>Mon, 26 Jan 2004 17:03:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174384#M161723</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2004-01-26T17:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: Are there lock files for passwd/useradd/usermod/userdel ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174385#M161724</link>
      <description>I have not had time to test this, but are you saying that if /etc/ptmp exists, none of those utilities will work?</description>
      <pubDate>Mon, 26 Jan 2004 17:07:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174385#M161724</guid>
      <dc:creator>jmb</dc:creator>
      <dc:date>2004-01-26T17:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: Are there lock files for passwd/useradd/usermod/userdel ?</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174386#M161725</link>
      <description>Yes, all of those commands including passwd respect/honor the /etc/ptmp convention. As long as ONLY those utilities , with the possible inclusion of vipw, are used to modify the passwd files/databases then the operations properly block. However, it must be stressed that any rogue cowboy/process with root permissions can completely ignore the existence of a lockfile. It is therefore imperative that all users with super-user priviliges restrict themselves to whatever conventions you adopt.&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Jan 2004 17:16:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/are-there-lock-files-for-passwd-useradd-usermod-userdel/m-p/3174386#M161725</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-01-26T17:16:49Z</dc:date>
    </item>
  </channel>
</rss>

