``````#!/bin/bash #Get Gids from LDAP names=\$(ldapsearch -xLLL "(objectClass=posixGroup)" gidNumber | grep dn | awk -F = '{print \$2}' | awk -F , '{print \$1}') ids=\$(ldapsearch -xLLL "(objectClass=posixGroup)" gidNumber | grep gidNumber | awk '{print \$2}') count=\$(ldapsearch -xLLL "(objectClass=posixGroup)" gidNumber | grep -c dn) #Convet strings to Arrays acount=\$(("\$count" - 1)) for i in \$(seq 1 "\$count"); do # echo loop debug \$i ai=\$(("\$i" - 1)) a_names[\$ai]=\$(echo "\$names" | awk '{print \$'"\$i"'}') # echo \${a_names[\$ai]} a_ids[\$ai]=\$(echo "\$ids" | awk '{print \$'"\$i"'}') # echo \${a_ids[\$ai]} done #Compare LDAP GIDS to System GIDS for a in \$(seq 0 \$acount); do # echo \${a_names[\$a]} # Check for group name in /etc/groups if [ "\$(grep -c "\${a_names[\$a]}" /etc/group)" -gt 0 ]; then # Check its been assigned the right gid [ "\$(grep "\${a_names[\$a]}" /etc/group | awk -F : '{print \$3}')" = "\${a_ids[\$a]}" ] || echo FUCK UP IN "\${a_names[\$a]}" Group is not assigned the correct GID else #IF Group is not there WARN AND ASK TO FIX echo "\${a_names[\$a]}:x:\${a_ids[\$a]} not in /etc/group" # Check for GID in use if [ "\$(grep -c :"\${a_ids[\$a]}": /etc/group)" -gt 0 ]; then #GID is in use echo GID "\${a_ids[\$a]}" in use by "\$(grep :"\${a_ids[\$a]}": /etc/group | awk -F : '{print \$1}')" #This is complicated bit that requires finding and chgrping files in use by GID #genetate new gid RANDOM=\$a newgid=\$RANDOM while [ "\$(grep -c :"\$newgid": /etc/group)" -gt 0 ]; do newgid=\$RANDOM done echo New GID is "\$newgid" else echo GID "\${a_ids[\$a]}" not in use # Append GID and name to /etc/group possible ask first echo "\${a_names[\$a]}:x:\${a_ids[\$a]}:" >> /etc/group #may use a fix variable for this instead and do writing at the end fi fi done #ASSIGN NEW GIDS #CHECH AND FIX GIDS of FILES NOT IN /STORAGE OR /FAST-STORAGE or TMP Dirs``````
{"ft_lang_label":"__label__en","ft_lang_prob":0.503195,"math_prob":0.5318247,"size":2073,"snap":"2021-31-2021-39","text_gpt3_token_len":707,"char_repetition_ratio":0.14258096,"word_repetition_ratio":0.050938338,"special_character_ratio":0.40617463,"punctuation_ratio":0.059139784,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.96306735,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-09-28T20:22:24Z\",\"WARC-Record-ID\":\"<urn:uuid:b05aef27-d8c3-46b6-93f7-589ce31ff353>\",\"Content-Length\":\"26405\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:ca3e1de9-303f-4e77-a0ea-aa5b527d630d>\",\"WARC-Concurrent-To\":\"<urn:uuid:c120ede3-826a-4718-b8fe-992ea79c5159>\",\"WARC-IP-Address\":\"136.206.15.3\",\"WARC-Target-URI\":\"https://git.redbrick.dcu.ie/Redbrick/admins-scripts/src/commit/7fc14f95b99d95245f15eeade9247c89e12d0385/bash/check_fix_gids.sh\",\"WARC-Payload-Digest\":\"sha1:NEG3GR5EG2SK2PQRQAGWIBSF3TRQVQQM\",\"WARC-Block-Digest\":\"sha1:SL3LM3T3NEE22SCXTFR3DDAYTKU5HHXH\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-39/CC-MAIN-2021-39_segments_1631780060882.17_warc_CC-MAIN-20210928184203-20210928214203-00350.warc.gz\"}"}