<?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 Does getpwuid work with /etc/shadow without root priviledge in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/does-getpwuid-work-with-etc-shadow-without-root-priviledge/m-p/5284647#M474798</link>
    <description>(re-post it to this column; firstly posted to languages and scripting; better to be here)&lt;BR /&gt;&lt;BR /&gt;Dear all,&lt;BR /&gt;&lt;BR /&gt;Can you please tell me if the routine getpwuid() works well with shadowed passwd as with /etc/passwd when using a non-root user to get its own hashed passwd (for some authentication in my application)?&lt;BR /&gt;&lt;BR /&gt;I have tried to write a little program to get some user's hashed passwd through a NIS/shadowed system and succeded. But that may be different as NIS to me seems not of high security, because I can use ypcat -k to see the hashed texts as well. When the /etc/passwd and /etc/shadow are stored locally, I don't know if the hashed passwd can still be got by the user itself or must via root user.&lt;BR /&gt;&lt;BR /&gt;I am learning to setup a shadowed test environment (will be very appreciated if someone kindly provides a guide). In the mean time, I would like to get double confirmation from experts here.&lt;BR /&gt;&lt;BR /&gt;Please share you expertise.&lt;BR /&gt;&lt;BR /&gt;Thanks a lot&lt;BR /&gt;Best regards&lt;BR /&gt;Kang</description>
    <pubDate>Wed, 15 Jun 2011 06:51:03 GMT</pubDate>
    <dc:creator>arking1981</dc:creator>
    <dc:date>2011-06-15T06:51:03Z</dc:date>
    <item>
      <title>Does getpwuid work with /etc/shadow without root priviledge</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/does-getpwuid-work-with-etc-shadow-without-root-priviledge/m-p/5284647#M474798</link>
      <description>(re-post it to this column; firstly posted to languages and scripting; better to be here)&lt;BR /&gt;&lt;BR /&gt;Dear all,&lt;BR /&gt;&lt;BR /&gt;Can you please tell me if the routine getpwuid() works well with shadowed passwd as with /etc/passwd when using a non-root user to get its own hashed passwd (for some authentication in my application)?&lt;BR /&gt;&lt;BR /&gt;I have tried to write a little program to get some user's hashed passwd through a NIS/shadowed system and succeded. But that may be different as NIS to me seems not of high security, because I can use ypcat -k to see the hashed texts as well. When the /etc/passwd and /etc/shadow are stored locally, I don't know if the hashed passwd can still be got by the user itself or must via root user.&lt;BR /&gt;&lt;BR /&gt;I am learning to setup a shadowed test environment (will be very appreciated if someone kindly provides a guide). In the mean time, I would like to get double confirmation from experts here.&lt;BR /&gt;&lt;BR /&gt;Please share you expertise.&lt;BR /&gt;&lt;BR /&gt;Thanks a lot&lt;BR /&gt;Best regards&lt;BR /&gt;Kang</description>
      <pubDate>Wed, 15 Jun 2011 06:51:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/does-getpwuid-work-with-etc-shadow-without-root-priviledge/m-p/5284647#M474798</guid>
      <dc:creator>arking1981</dc:creator>
      <dc:date>2011-06-15T06:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Does getpwuid work with /etc/shadow without root priviledge</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/does-getpwuid-work-with-etc-shadow-without-root-priviledge/m-p/5284648#M474799</link>
      <description>I know nothing about the innards of the password system, but a quick view of the shadow(4) man page seems to indicate you should be using getspent(3c)&lt;BR /&gt;&lt;BR /&gt;getspent() seems to work for standard passwd, shadow, and for trusted systems. I have no idea whether a non-root user can get the password hash out of it though... I thought the whole point of shadow was to prevent non-root users viewing the password hash.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Duncan</description>
      <pubDate>Wed, 15 Jun 2011 07:45:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/does-getpwuid-work-with-etc-shadow-without-root-priviledge/m-p/5284648#M474799</guid>
      <dc:creator>Duncan Edmonstone</dc:creator>
      <dc:date>2011-06-15T07:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: Does getpwuid work with /etc/shadow without root priviledge</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/does-getpwuid-work-with-etc-shadow-without-root-priviledge/m-p/5284649#M474800</link>
      <description>Nope, a non-privileged user cannot call getspent() or getspnam() at all: you'll only get a NULL pointer and errno set to EPERM as a result.&lt;BR /&gt;&lt;BR /&gt;The "traditional" way would be to create a minimal helper program to check the password and do nothing else: this program would be very carefully tested and then installed as setuid root (or setgid shadow, if the "shadow" group exists and has read-only access to /etc/shadow in your architecture). The application would then call this helper program to check the password.&lt;BR /&gt;&lt;BR /&gt;This required each application developer to create his/her own helper programs if authentication was required and the application was not supposed to run as root. This led to a lot of developers doing essentially the same thing over and over, sometimes badly: for example, the password must not be passed to the helper program as a command-line argument, because command lines are visible to the ps(1) command, which is available to any user on the system.&lt;BR /&gt;&lt;BR /&gt;To fix this, PAM was developed. It is quite a bit more complex, but essentially allows an unprivileged application to pass the username and password to the PAM library and receive a result that tells if it was correct or not.&lt;BR /&gt;&lt;BR /&gt;As a side benefit, PAM allows the actual authentication mechanism to be replaced easily: by replacing one PAM component library with another that implements the same API, you can switch from local passwd/shadow authentication to authentication based on NIS, NISPLUS, LDAP, RADIUS or something else. If the application follows PAM specifications, no application-level changes are required for this.&lt;BR /&gt;&lt;BR /&gt;I didn't find a HP-UX specific PAM programming API example, but I understand the PAM API is fairly generic. Here's one Linux document that includes programming example:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://content.hccfl.edu/pollock/AUnix2/PAM-Help.htm" target="_blank"&gt;http://content.hccfl.edu/pollock/AUnix2/PAM-Help.htm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;See the chapter titled "Under the Hood of PAM â   A Programmers Perspective".&lt;BR /&gt;&lt;BR /&gt;MK</description>
      <pubDate>Wed, 15 Jun 2011 09:16:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/does-getpwuid-work-with-etc-shadow-without-root-priviledge/m-p/5284649#M474800</guid>
      <dc:creator>Matti_Kurkela</dc:creator>
      <dc:date>2011-06-15T09:16:01Z</dc:date>
    </item>
    <item>
      <title>Re: Does getpwuid work with /etc/shadow without root priviledge</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/does-getpwuid-work-with-etc-shadow-without-root-priviledge/m-p/5284650#M474801</link>
      <description>thank guys. it helps a lot.&lt;BR /&gt;points were assigned.</description>
      <pubDate>Thu, 16 Jun 2011 01:47:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/does-getpwuid-work-with-etc-shadow-without-root-priviledge/m-p/5284650#M474801</guid>
      <dc:creator>arking1981</dc:creator>
      <dc:date>2011-06-16T01:47:00Z</dc:date>
    </item>
  </channel>
</rss>

