Files

Top 5 most useful commands or tools for Linux administrators

By WladyX on 21 April, 2010 | Files, General, Scripts | A comment?

Example user-dirs.dirs

cat $HOME/.config/user-dirs.dirs

# This file is written by xdg-user-dirs-update
# If you want to change or add directories, just edit the line you're
# interested in. All local changes will be retained on the next run
# Format is XDG_xxx_DIR="$HOME/yyy", where yyy is a shell-escaped
# homedir-relative path, or XDG_xxx_DIR="/yyy", where /yyy is an
# absolute path. No other format is supported.
#

XDG_DESKTOP_DIR="$HOME/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/Public"
XDG_DOCUMENTS_DIR="$HOME/Documents"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_VIDEOS_DIR="$HOME/Videos"

By WladyX on 17 March, 2010 | Files, General, Style, X11 | A comment?

fstab

#
# /etc/fstab: static file system information
#
# <file system>        <dir>         <type>    <options>          <dump> <pass>
none                   /dev/pts      devpts    defaults            0      0
none                   /dev/shm      tmpfs     defaults            0      0

UUID=e0b36ac8-1e88-409c-a7da-a01876d93815 swap swap defaults 0 0
UUID=94fb2519-60da-4fcb-907e-e1c384ff7e64 / reiserfs defaults 0 1
UUID=94fb2519-60da-4fcb-907e-e1c384ff7e64 /media/arch      reiserfs defaults,noatime 0 0
UUID=7f91f518-33a9-4b2d-96d4-d64dd12af94d /media/arch2     reiserfs noatime,notail,noauto               0       2
UUID=1a6211b4-72b7-42fb-bbc0-de416904d1f0 /media/ubuntu    reiserfs noatime,notail,notail,noauto        0       2
UUID=dbe53520-00c5-4f62-a768-c5a63f4e9bac /media/storage   ext3 noatime,users,rw,acl                    0       2
UUID=efc260ea-5214-4168-90d7-88765ac471ae /media/backup    ext3 noatime,noauto,rw                       0       0
UUID=39351753-0f71-49f1-9daa-a8c0e29afb6a /media/backup-os reiserfs noatime,noauto,defaults             0       0
UUID=C26C99E96C99D90D /media/winxp                         ntfs-3g defaults,umask=007,gid=100   0       0
UUID=0454811F54811498 /media/xpgames                       ntfs-3g defaults,umask=007,gid=100   0       0
/dev/cdrom       /media/dvdrom      iso9660     noauto,user,ro   0   0

By WladyX on 18 August, 2009 | Files, General | A comment?

dispatch-conf

#
# dispatch-conf.conf
#

# Directory to archive replaced configs
archive-dir=/etc/config-archive

# Use rcs for storing files in the archive directory?
# (yes or no)
use-rcs=no

# Diff for display
# %s old file
# %s new file
#diff=”diff -Nu %s %s | less –no-init –QUIT-AT-EOF”
diff=”colordiff -u %s %s | less”

# Diff for interactive merges.
# %s output file
# %s old file
# %s new file
merge=”sdiff –suppress-common-lines –output=%s %s %s”

# Automerge files comprising only CVS interpolations (e.g. Header or Id)
# (yes or no)
replace-cvs=yes

# Automerge files comprising only whitespace and/or comments
# (yes or no)
replace-wscomments=yes

# Automerge files that the user hasn’t modified
# (yes or no)
replace-unmodified=yes

# Per-session log file of changes made to configuration files
log-file=/var/log/dispatch-conf.log

NOTE:

You can disable this feature by setting CONFIG_PROTECT=”-*” in /etc/make.conf.
Then, Portage will mercilessly auto-update your config files. Alternatively,
you can leave Config File Protection on but tell Portage that it can overwrite
files in certain specific /etc subdirectories. For example, if you wanted
Portage to automatically update your rc scripts and your wget configuration,
but didn’t want any other changes made without your explicit approval, you’d
add this to /etc/make.conf:

CONFIG_PROTECT_MASK=/etc/wget /etc/rc.d

http://linuxreviews.org/man/emerge/

By WladyX on 8 April, 2008 | Files, Gentoo | A comment?

.htaccess example file

AuthUserFile /usr/local/etc/apache22/passwd/KB
AuthName “Authorization Required”
AuthType Basic
require valid-user

By WladyX on 19 February, 2008 | Apache, Files, General | A comment?

Postfix

Postfix relay:

main.cf:

relay_domains = example.com, example2.com

smtpd_recipient_restrictions = …, reject_unauth_destination (recomandat)

pentru a defini unde se trimit mailurile de relay:

/etc/postfix/transport:

example.com smtp:mx.example.com

Links:
http://www.postfix.org/faq.html#backup

Postgrey (Greylisting) :

Se copiaza din arhiva de postfix din directorul examples/smtpd-policy scriptul greylist.pl in /usr/local/bin
Se editeaza greylist.pl:

$database_name=”/etc/postfix/greylist.db”;
$greylist_delay=60;

Nota: prima variabilal este fisierul unde se va pastra baza de date, iar a doua delay-ul in secunde dupa care se accepta mailul.
trebuie creat /etc/postfix/greylist.db si modificate permisiile astfel incat postfix sa poata citi si modifica acest fisier.

master.cf:

policy unix – n n – - spawn
user=nobody argv=/usr/bin/perl /usr/local/bin/greylist.pl -v

Nota: -v este pentru a fi verbose in loguri.

/etc/postfix/main.cf:

smtpd_recipient_restrictions =
reject_unlisted_recipient

reject_unauth_destination
check_sender_access hash:/etc/postfix/sender_access
check_policy_service unix:private/policy

policy_time_limit = 3600

Nota: in sender_access se pun domeniile considerate ca nu trimit spam si astfel vor sari de verificarea greylisting.
Trebuie creat acest fisier si dupa fiecare modificare rulat: postmap /etc/postfix/sender_access

Exemplu de fisier:
/etc/postfix/sender_access:
securityfocus.com OK

links:
How to kill 95%+ off your SPAM fast!
http://www.postfix.org/SMTPD_POLICY_README.html

By WladyX on 12 November, 2006 | Files, Mail | A comment?