LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-09-2008, 12:49 PM   #1
jim.thornton
Member
 
Registered: May 2007
Posts: 404

Rep: Reputation: 19
why isn't this find command working?


Somehow a bunch of files within my directory structure have changed owners (to sshd).

I need to run a command that will recursively go through all of the directories and change the owner. Here is what I have:

find ./ -type f -user sshd -exec 'chown diradmin {}'

I'm trying to change the owner from sshd to diradmin, the group is fine and doesn't need to be changed.

Can someone tell me what I am doing wrong please?
 
Old 06-09-2008, 01:01 PM   #2
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 69
Quote:
Originally Posted by jim.thornton View Post
Somehow a bunch of files within my directory structure have changed owners (to sshd).

I need to run a command that will recursively go through all of the directories and change the owner. Here is what I have:

find ./ -type f -user sshd -exec 'chown diradmin {}'

I'm trying to change the owner from sshd to diradmin, the group is fine and doesn't need to be changed.

Can someone tell me what I am doing wrong please?
Try it like this

find . -type f -user sshd -exec chown diradmin {} \;
 
Old 06-09-2008, 01:03 PM   #3
jiml8
Senior Member
 
Registered: Sep 2003
Posts: 3,171

Rep: Reputation: 115Reputation: 115
find ./ means find in the current directory. Is that what you want? I think you want find /.

Or. perhaps, you don't have permission to execute the change you are trying to make?

Last edited by jiml8; 06-09-2008 at 01:06 PM.
 
Old 06-10-2008, 07:39 AM   #4
jim.thornton
Member
 
Registered: May 2007
Posts: 404

Original Poster
Rep: Reputation: 19
Thank you.

I ended up going to the directory and running # chown diradmin $(find ./ -user sshd)

It seems to have done the job.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Find/grep command to find matching files, print filename, then print matching content stefanlasiewski Programming 9 06-30-2016 06:30 PM
[SOLVED] find command is not working postiwala Linux - General 7 09-11-2006 02:25 PM
find command not working correctly? hak_uc Linux - General 10 05-30-2006 09:59 PM
same find command not working in bash script, quotes? QuakerOatz Linux - Software 1 07-14-2003 01:04 PM
makeing Find command not case sensitive? -ilname isnt working. systemgsr Linux - General 2 12-25-2001 01:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration