Results 1 to 10 of 10
  1. #1
    Join Date
    May 2002
    Location
    USA
    Posts
    490

    SSH find command and then chmod all found

    Hello,

    I would like to execute a file command in SSH to find all files with the 750 permissions, and then chmod ONLY the files with 750 permissions to 777.

    The thing, is I can't do it to each file individually because, it would take me waaaaay to long, since I have alot of files. And this must be done, because I get an 403 error other wise.

    I really need to do this, please help!

    Thank you!
    David Garza
    CCF Web Hosting - Where Customers Come First!
    Phone: 1.630.885.9009 | Email: david(a)ccfhosting.com
    MSN: dgarza(a)ccfhosting.com | AIM: CCF DGarza | ICQ: 51140109

  2. #2
    Join Date
    Oct 2002
    Location
    Tampa, FL
    Posts
    42

    Re: SSH find command and then chmod all found

    Originally posted by Mind-Field
    Hello,

    I would like to execute a file command in SSH to find all files with the 750 permissions, and then chmod ONLY the files with 750 permissions to 777.

    The thing, is I can't do it to each file individually because, it would take me waaaaay to long, since I have alot of files. And this must be done, because I get an 403 error other wise.

    I really need to do this, please help!

    Thank you!

    find /dir/* -perm 750 | xargs chmod 777

  3. #3
    Join Date
    Dec 2001
    Location
    Detroit, MI
    Posts
    1,067
    find dir -perm 750 -exec chmod 777 {} \;
    <!-- boo! -->

  4. #4
    Join Date
    May 2002
    Location
    USA
    Posts
    490
    Thank you BOTH OF YOU!!!
    You are wonderful. The funny thing is, I just found the command to do, on google.

    find . -perm 750 -ls -exec chmod 777 {} \;

    It is exactly the same as Dizix's code.

    Thank you again!!
    David Garza
    CCF Web Hosting - Where Customers Come First!
    Phone: 1.630.885.9009 | Email: david(a)ccfhosting.com
    MSN: dgarza(a)ccfhosting.com | AIM: CCF DGarza | ICQ: 51140109

  5. #5
    Originally posted by Mind-Field
    Thank you BOTH OF YOU!!!
    You are wonderful. The funny thing is, I just found the command to do, on google.
    Yeah, Google is always my good friend.
    AceWebHosting.Com
    Cheap Web Hosting - Multiple Domain Hosting - Reseller Hosting - Virtual Private Server

  6. #6
    Join Date
    Oct 2001
    Location
    san diego
    Posts
    256
    since this can be done, how would one go about searching for all instances of FormMail.pl and renaming that to Form.pl. This must change the file name as well as the word FormMail.pl in any html pages. It seems like this can be done with xargs and grep but cant seem to figure it out. any help is greatly appreciated.

  7. #7
    Join Date
    Apr 2001
    Location
    Palm Beach, FL
    Posts
    1,095
    Originally posted by jahsh
    since this can be done, how would one go about searching for all instances of FormMail.pl and renaming that to Form.pl. This must change the file name as well as the word FormMail.pl in any html pages. It seems like this can be done with xargs and grep but cant seem to figure it out. any help is greatly appreciated.
    Use find and xargs (or the -exec option to find) to find all formmail.pl files and rename them to form.pl.

    Use grep with xargs and sed to find files that contain "formmail.pl" and change the text to "form.pl".
    Alex Llera
    Professional Server Management
    FreeBSD|Linux|HSphere|Cpanel|Plesk

  8. #8
    Join Date
    Oct 2001
    Location
    san diego
    Posts
    256
    that is what i have been doing. i cant seem to get either to work. i will keep trying. thanks for the info. can you post an actual command if you find the time. thanks again

  9. #9
    Join Date
    Dec 2001
    Location
    Detroit, MI
    Posts
    1,067
    This may help:

    http://www.webhostingtalk.com/showth...threadid=34600

    Something like this is something you should do in a test directory before doing globally, and even then only simulate it globally before actually running the command. It's very risky to do a global search and replace.

    That said, here is the simple way to identify the actual files with the text:
    find dir -exec egrep -li "action.*formmail.pl" {} \;
    Pipe this through xargs with your perl script as the executor. Remember, take great care when doing this type of work.
    <!-- boo! -->

  10. #10
    Join Date
    Oct 2001
    Location
    san diego
    Posts
    256
    thanks for the reply. I am still not able to get this to work. I will keep pluggin away, sure is frustrating....
    anyone done this that has the exact syntax. this is just a standard redhat box. thanks guys

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •