<?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: Fixing user files in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187160#M460874</link>
    <description>closing it as I have found a different approach.</description>
    <pubDate>Tue, 14 Jul 2009 14:55:42 GMT</pubDate>
    <dc:creator>Robert Legatie</dc:creator>
    <dc:date>2009-07-14T14:55:42Z</dc:date>
    <item>
      <title>Fixing user files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187149#M460863</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I am trying to fix files which do not have users. I am using the following find command for it.&lt;BR /&gt;find / \( -nouser -o -nogroup \) | xargs ls -ld&lt;BR /&gt; Suppose it gives us an output of&lt;BR /&gt;-rwxr-----    1 12345   user_unix         943 Jan 13 12:12 /home/abcd/.profile&lt;BR /&gt;&lt;BR /&gt;From the above output it is obvious that this file belongs to user "abcd" but is owned by 12345 which does not exist in /etc/passwd.&lt;BR /&gt;&lt;BR /&gt;Can someone help me with a command or maybe a couple of lines of script to change the file to be owned by user "abcd" from "12345". I have many files like this that needs to be changed.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 13 Jul 2009 18:19:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187149#M460863</guid>
      <dc:creator>Robert Legatie</dc:creator>
      <dc:date>2009-07-13T18:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: Fixing user files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187150#M460864</link>
      <description>is there any particular reason why you can not use this:&lt;BR /&gt;&lt;BR /&gt;find / \( -nouser -o -nogroup \) | xargs chown abcd&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 13 Jul 2009 18:24:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187150#M460864</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-07-13T18:24:05Z</dc:date>
    </item>
    <item>
      <title>Re: Fixing user files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187151#M460865</link>
      <description>find / \( -user 12345 \) |xargs chown abcd&lt;BR /&gt;&lt;BR /&gt;would do it.  If you have many of them you could redirect the output of your "nouser/nogroup/ command to a file and then use that as input to a for loop.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Pete</description>
      <pubDate>Mon, 13 Jul 2009 18:25:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187151#M460865</guid>
      <dc:creator>Pete Randall</dc:creator>
      <dc:date>2009-07-13T18:25:45Z</dc:date>
    </item>
    <item>
      <title>Re: Fixing user files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187152#M460866</link>
      <description>Otherwise, you can send the output to a file &lt;BR /&gt;&lt;BR /&gt;find / \( -nouser -o -nogroup \) | xargs ls -ld &amp;gt; /tmp/ownerless_files&lt;BR /&gt;&lt;BR /&gt;then process this file in a way like this:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;cat /tmp/ownerless_files | while read line &lt;BR /&gt;do&lt;BR /&gt;owner=`echo $line | awk {'print $3'}`&lt;BR /&gt;group=`echo $line | awk {'print $4'}`&lt;BR /&gt;filename=`echo $line | awk {'print $9'}`&lt;BR /&gt;&lt;BR /&gt;if [ "${owner}" = "12345" ]&lt;BR /&gt;then&lt;BR /&gt;chown abcd ${filename}&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;#replicate the above 'if' block as many times as necessary depending on &lt;BR /&gt;#conditions you want to test for users and groups&lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;This should do it.</description>
      <pubDate>Mon, 13 Jul 2009 18:30:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187152#M460866</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-07-13T18:30:14Z</dc:date>
    </item>
    <item>
      <title>Re: Fixing user files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187153#M460867</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;# find /path \( -nouser -o -nogroup \) -exec chown abcd {} +&lt;BR /&gt;&lt;BR /&gt;Be careful.  I would limit your '/path' to that which is known to require change.  You don't want to capricioulsy transfer ownership of files.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...&lt;BR /&gt;</description>
      <pubDate>Mon, 13 Jul 2009 18:35:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187153#M460867</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-13T18:35:26Z</dc:date>
    </item>
    <item>
      <title>Re: Fixing user files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187154#M460868</link>
      <description>I am getting a syntax error "do" is not matched. I am using the following:&lt;BR /&gt;#!/usr/bin/sh&lt;BR /&gt;find / \( -nouser -o -nogroup \) | xargs ls -ld &amp;gt; /tmp/test&lt;BR /&gt;cat /tmp/test | while read line&lt;BR /&gt;do&lt;BR /&gt;owner=`echo $line | awk {'print $3'}`&lt;BR /&gt;group=`echo $line | awk {'print $4'}`&lt;BR /&gt;filename=`echo $line | awk {'print $9'}`</description>
      <pubDate>Mon, 13 Jul 2009 18:53:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187154#M460868</guid>
      <dc:creator>Robert Legatie</dc:creator>
      <dc:date>2009-07-13T18:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: Fixing user files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187155#M460869</link>
      <description>&lt;!--!*#--&gt;Exactly what you want is not entirely clear.&lt;BR /&gt;&lt;BR /&gt;If you want all the files under "/home/abcd/"&lt;BR /&gt;to be owned by user "abcd", then you might&lt;BR /&gt;write a script which loops through all the&lt;BR /&gt;directories "/home/*", and does a "find -exec"&lt;BR /&gt;on each one.  If you want only the owner-less&lt;BR /&gt;or group-less files to be affected, then&lt;BR /&gt;that's also possible.&lt;BR /&gt;&lt;BR /&gt;While working on your script, you might wish&lt;BR /&gt;to add an "echo" command to your "-exec"&lt;BR /&gt;clause, so that you can see what will happen&lt;BR /&gt;_before_ you wreck something.</description>
      <pubDate>Mon, 13 Jul 2009 19:00:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187155#M460869</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-07-13T19:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Fixing user files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187156#M460870</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I am getting a syntax error "do" is not matched.  &lt;BR /&gt;&lt;BR /&gt;Well, try adding a closing 'done'.  You are making this harder than it needs to be.&lt;BR /&gt;&lt;BR /&gt;# find /path \( -nouser -o -nogroup \)|xargs -t -n1 chown abcd&lt;BR /&gt;&lt;BR /&gt;...gives you a trace and the change.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Mon, 13 Jul 2009 19:06:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187156#M460870</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2009-07-13T19:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: Fixing user files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187157#M460871</link>
      <description>Steven,&lt;BR /&gt;Right, I only want to change those found to be unowned by the find command. Can you please spell out the loop here on how do i change it.&lt;BR /&gt;&lt;BR /&gt;thanks.</description>
      <pubDate>Mon, 13 Jul 2009 19:06:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187157#M460871</guid>
      <dc:creator>Robert Legatie</dc:creator>
      <dc:date>2009-07-13T19:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: Fixing user files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187158#M460872</link>
      <description>find / \( -nouser -o -nogroup \) | xargs ls -ld &amp;gt; /tmp/test&lt;BR /&gt;cat /tmp/test | while read line&lt;BR /&gt;do&lt;BR /&gt;owner=`echo $line | awk {'print $3'}`&lt;BR /&gt;group=`echo $line | awk {'print $4'}`&lt;BR /&gt;filename=`echo $line | awk {'print $9'}`&lt;BR /&gt;&lt;BR /&gt;#  do something here &lt;BR /&gt;&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;this above is your construct. &lt;BR /&gt;&lt;BR /&gt;you can replace &lt;BR /&gt;&lt;BR /&gt;# do something here &lt;BR /&gt;&lt;BR /&gt;line with either:&lt;BR /&gt;&lt;BR /&gt;(1)&lt;BR /&gt;*********************************&lt;BR /&gt;if [ "${owner}" = "12345" ]&lt;BR /&gt;then&lt;BR /&gt;chown abcd ${filename}&lt;BR /&gt;fi&lt;BR /&gt;*********************************&lt;BR /&gt;&lt;BR /&gt;or &lt;BR /&gt;&lt;BR /&gt;(2)&lt;BR /&gt;*********************************&lt;BR /&gt;chown abcd ${filename}&lt;BR /&gt;*********************************&lt;BR /&gt;&lt;BR /&gt;Option number (2) is the same as what any of the find blah-blah | xargs chown blah-blah will give you as the result.&lt;BR /&gt;&lt;BR /&gt;Your problem definition is very vague. If you state what you want done from the get-go, this thread would not stretch this long. Sysadmins are pretty much like computers. They do what you "tell" them to do not what "want" done. WIsh I have mind reading capabilities but it is coming in my Mel Burslan V2.0 in the next life.</description>
      <pubDate>Mon, 13 Jul 2009 19:21:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187158#M460872</guid>
      <dc:creator>Mel Burslan</dc:creator>
      <dc:date>2009-07-13T19:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: Fixing user files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187159#M460873</link>
      <description>&lt;!--!*#--&gt;&amp;gt; Can you please spell out the loop here on&lt;BR /&gt;&amp;gt; how do i change it.&lt;BR /&gt;&lt;BR /&gt;My idea of a good time is to help someone&lt;BR /&gt;over a rough spot when he's stuck.  Doing&lt;BR /&gt;someone's whole job for him, for free, when&lt;BR /&gt;he seems unwilling or unable to learn how to&lt;BR /&gt;do it himself, is _not_ my idea of a good&lt;BR /&gt;time.  But you can probably find someone else&lt;BR /&gt;with different ideas.</description>
      <pubDate>Tue, 14 Jul 2009 00:53:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187159#M460873</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-07-14T00:53:30Z</dc:date>
    </item>
    <item>
      <title>Re: Fixing user files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187160#M460874</link>
      <description>closing it as I have found a different approach.</description>
      <pubDate>Tue, 14 Jul 2009 14:55:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/fixing-user-files/m-p/5187160#M460874</guid>
      <dc:creator>Robert Legatie</dc:creator>
      <dc:date>2009-07-14T14:55:42Z</dc:date>
    </item>
  </channel>
</rss>

