#fileuid()

DESCRIPTION
    returns the user id (uid) of a file's owner
SYNOPSIS
    #fileuid(s)
ARGUMENTS
    s - a quoted string, or string expression, representing a filepath
EXAMPLES
# pikt +C 'output $text(#fileuid("/etc/passwd"))'
0
        rule
                set #fu = #fileuid($inlin)

        rule
                if #fu != %fu
                        output mail "for $inlin, uid has changed"
                fi
        rule    // check devfile ownerships and permissions
                set $devfile = =devfile($mount)
#  ifdef debug
                output $devfile
#  endifdef
                if #fileuid($devfile) != 0      // root
                        output "$mount devfile $devfile not root-owned"
                fi
                if #filegid($devfile) != =sysgid
                        output "$mount devfile $devfile not sys-owned"
                fi
                if $filemode($devfile) ne "060640"
                        output "$mount devfile $devfile perms not 060640,
                                are $filemode($devfile)"
                fi

        rule    // check rawdevfile ownerships and permissions
                set $rawdevfile = =rawdevfile($mount)
#  ifdef debug
                output $rawdevfile
#  endifdef
                if #fileuid($rawdevfile) != 0   // root
                        output "$mount rawdevfile $rawdevfile not root-owned"
                fi
                if #filegid($rawdevfile) != =sysgid
                        output "$mount rawdevfile $rawdevfile not sys-owned"
                fi
                if $filemode($rawdevfile) ne "020640"
                        output "$mount rawdevfile $rawdevfile perms not 020640,
                                are $filemode($rawdevfile)"
                fi
SEE ALSO
    #fileino()
    #filelinks()
    #filegid()
    #fileatime()
    #filectime()
    #filemtime()
    #filesize()

    Numerical Functions
    String Functions
 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2019-01-12.   This site is PIKT® powered.
Copyright © 1998-2019 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
passwd file
problems
Pikt script