0

Hi I am using the below to check for the files which are owned by user not defined in system configuration:

df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -nouser -ls

The result is:

3282546    0 lrwxrwxrwx   1 613      users          19 Feb 12 12:46 /apps/omni/streams/lib32/libstreams.c -> ../lib/libstreams.c

The actual file has owner,group as:

# ll /apps/omni/streams/lib/libstreams.c
-r--r--r-- 1 root root 7668 Jan 17  2014 /apps/omni/streams/lib/libstreams.c

I want to change the owner,group of the link as well to root. I'm using the below, but it doesn't work:

 df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -nouser | xargs chown root:root

Anything I'm missing ?

dig_123
  • 2,240
  • 6
  • 35
  • 59
  • 1
    run this: `df --local -P | awk {'if (NR!=1) print $6'} | xargs -I '{}' find '{}' -xdev -nouser | xargs -I filename echo chown root:root filename`, this will show what you're trying to do per file. Please add the output. – Tiago Lopo Feb 19 '15 at 19:46
  • 1
    My version of `chown` says that the option `-h` will not dereference the symlink - so `chown -h root:root somelink`... Oh the other hand, I've seen some instances where all symlinks are owned by `root`, regardless of who created them - but that's obviously not your case here... – twalberg Feb 19 '15 at 19:56
  • @twalberg : sweet, `-h` works..thanks ! – dig_123 Feb 19 '15 at 20:04

0 Answers0