Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2005
    Posts
    18

    Question Unanswered: Checking File Permissions Before Using it ?

    Hi all,

    I need to check the permissions of a file before using that file to access a Web Service. I need to check that only the 'user' has 'rwx' permissions, at the same time, the 'group' and 'others' part of the permissions string should not contain anything. That is, I should have a permission string as shown below for a file:

    -rwx------

    Can anybody tell me how to do this? A script should be very helpful.

    I appreciate your time.

    Thanks a lot,
    sbk

  2. #2
    Join Date
    Aug 2004
    Location
    Rome, Italy
    Posts
    81

    check file permissions

    Use this:

    if test `ls -l anasti-tel1-ritp.txt| awk '{if($1=="-rwxr-----") print 0;else print 1}'` -eq 0
    then echo "OK"
    else echo "KO"
    fi

    I hope it's worthy for you.


    Bye bye,
    ducasio

  3. #3
    Join Date
    Jan 2005
    Posts
    18
    Thanks ducasio,

    It worked !

Posting Permissions

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