<?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: setuid in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/setuid/m-p/3023476#M131035</link>
    <description>Yes, I have just a little bit of experience in using setuid in c. What you are trying to do is hopeless unless 1) root owns this executable and 2) the setuid bit is set on the file (e.g chmod 4755 myfile). It's a very good thing it works this way!! If your method worked then anyone could become super-user anytime they wanted to!</description>
    <pubDate>Tue, 15 Jul 2003 03:05:34 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2003-07-15T03:05:34Z</dc:date>
    <item>
      <title>setuid</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setuid/m-p/3023474#M131033</link>
      <description>I have a c program as below. the execute file owner is not root, assume is use1. I'd like to set the user id to ZERO while run the program.&lt;BR /&gt;But this program "setuid(0)" always run error.&lt;BR /&gt;Does anyone has the experience how to use the setuid() in C program?&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;UNISTD.H&gt;&lt;BR /&gt;&lt;BR /&gt;main()&lt;BR /&gt;if(setuid(0) &amp;lt; 0) {&lt;BR /&gt;   printf("setuid error ");&lt;BR /&gt;   exit(1);&lt;BR /&gt;}&lt;/UNISTD.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Tue, 15 Jul 2003 01:01:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setuid/m-p/3023474#M131033</guid>
      <dc:creator>j773303</dc:creator>
      <dc:date>2003-07-15T01:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: setuid</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setuid/m-p/3023475#M131034</link>
      <description>With setuid() you have to have root as the owner of the file and have setuid bit set on the file. Then it will work properly.&lt;BR /&gt;&lt;BR /&gt;Here is a sample program which sets the uid to root and runs some file and then exits.&lt;BR /&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;#include &lt;STRING.H&gt;&lt;BR /&gt;#include &lt;UNISTD.H&gt;&lt;BR /&gt;&lt;BR /&gt;main(argc,argv)&lt;BR /&gt;int argc;&lt;BR /&gt;int *argv[];&lt;BR /&gt;{ &lt;BR /&gt;&lt;BR /&gt;int uid;&lt;BR /&gt;char *command=(char *)malloc(2048);&lt;BR /&gt;&lt;BR /&gt;uid=getuid();&lt;BR /&gt;setuid(0);&lt;BR /&gt;strcpy(command,"/home/rshukla/scripts/killfsq");&lt;BR /&gt;if ( system(command) !=0 ) {&lt;BR /&gt;  printf("1:Failed to kill the FSQ \n");&lt;BR /&gt;  exit(1);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;printf("0:FSQ Killed ...\n");&lt;BR /&gt;} &lt;BR /&gt;&lt;BR /&gt;the compiled program fsqkill should have following permissions.&lt;BR /&gt;&lt;BR /&gt;-r-sr-xr-x   1 root       sys          20480 Sep 23  2002 fsqkill&lt;BR /&gt;&lt;BR /&gt;Then it will work properly.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Rajeev&lt;/UNISTD.H&gt;&lt;/STRING.H&gt;&lt;/STDIO.H&gt;</description>
      <pubDate>Tue, 15 Jul 2003 01:59:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setuid/m-p/3023475#M131034</guid>
      <dc:creator>Rajeev  Shukla</dc:creator>
      <dc:date>2003-07-15T01:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: setuid</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setuid/m-p/3023476#M131035</link>
      <description>Yes, I have just a little bit of experience in using setuid in c. What you are trying to do is hopeless unless 1) root owns this executable and 2) the setuid bit is set on the file (e.g chmod 4755 myfile). It's a very good thing it works this way!! If your method worked then anyone could become super-user anytime they wanted to!</description>
      <pubDate>Tue, 15 Jul 2003 03:05:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setuid/m-p/3023476#M131035</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2003-07-15T03:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: setuid</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/setuid/m-p/3023477#M131036</link>
      <description>I found that with the Goldbase June 2003 and Dec 2003 pathes installed, it fails all the time. Don't know if this is on your system.&lt;BR /&gt;&lt;BR /&gt;Tried uninstalling and it started working again. They must have changed the library ??</description>
      <pubDate>Thu, 18 Dec 2003 20:42:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/setuid/m-p/3023477#M131036</guid>
      <dc:creator>Niel Greeff</dc:creator>
      <dc:date>2003-12-18T20:42:46Z</dc:date>
    </item>
  </channel>
</rss>

