This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
find /tmp/ -user www-user.old -exec chown www-user:user {} \; | |
find /tmp/ -user user.old -exec chown user:user {} \; | |
* Détecter les fichiers non lisibles par Apache (lecture sur le groupe) : find ./ -type f ! -perm /g=r -exec ls -l {} \; | |
* Détecter les répertoires non lisibles par Apache (lecture/exécution sur le groupe) : find ./ -type d \( ! -perm /g=r -o ! -perm /g=x \) -exec ls -ld {} \; | |
* Détecter les fichiers/répertoires accessibles en écriture par Apache (écriture sur le groupe) : find ./ -perm /g=w | |
* Détecter les fichiers/répertoires accessibles en écriture par tous : find ./ -perm -007 -o -type f -perm -006 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in user1 user2 user3...; do echo -n 'useradd -m -s /bin/bash -u '$(grep -E "^$i" /etc/passwd | cut -d':' -f3) && echo -en ' -p' \'$(grep -E "^$i" /etc/shadow | cut -d ':' -f2)\' $i '\n'; done | |
Output : | |
useradd -m -s /bin/bash -u USERID -p 'USERPWD' username |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find files newert than (mtime) a precise date, and execute an action. | |
find . ! -newermt '2012-09-19 11:40:00' -exec cp {} /tmp/mails \; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
date=$(date +%Y%m%d) | |
for homedir in toto tata titi; | |
do | |
if [ -d /home/${homedir} ] ; then | |
echo "Deactivating $homedir vacation"; | |
cd /home/${homedir} | |
mv .forward .forward.${date} | |
mv .vacation.db .vacation.db.${date} | |
mv .vacation.msg .vacation.msg.${date} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd /etc/apache2/sites-available/ | |
for vhostname in *; | |
do | |
if [ -f /etc/awstats/awstats.${vhostname}.conf ]; then | |
echo "Traiter le vhost $vhostname ? [Y/n]" | |
read | |
if [ "$REPLY" = "n" ]; then | |
continue; | |
fi |
NewerOlder