Add domain to bind

18 12 2009

What have i made:
1) added to named.conf

zone “DOMAIN” in {
allow-transfer { localnets; };
file “master/DOMAIN”;
type master;
};
zone “2.168.192.in-addr.arpa” in {
allow-transfer { localnets; };
file “master/2.168.192.zone”;
type master;
};

2) created at /var/named/master files
DOMAIN:
$TTL 2D
@ IN SOA server.DOMAIN. root.DOMAIN. (
2008120711 ; serial
3H ; refresh
1H ; retry
1W ; expiry
1D ) ; minimum
IN NS localhost.

DOMAIN. IN A 192.168.2.15
* IN CNAME DOMAIN.

2.168.192.zone:
$TTL 2D
@ IN SOA server.DOMAIN. root.DOMAIN. (
2008120701 ; serial
3H ; refresh
1H ; retry
1W ; expiry
1D ) ; minimum
IN NS localhost.

15 IN PTR DOMAIN.

3) restarted named





Check TCP and port

18 12 2009

Command for check: iptables -tulpen

The result is:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State User Inode PID/Program name
tcp 0 0 0.0.0.0:39496 0.0.0.0:* LISTEN 1000 52632 15541/skype
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 60 10410 4188/mysqld
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 0 7706 2997/rpcbind
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 65534 30477 10521/dansguardian
tcp 0 0 0.0.0.0:6000 0.0.0.0:* LISTEN 0 8130 3176/X
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 0 11794 4494/vsftpd
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 11689 4469/sshd
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 0 9878 4190/cupsd
tcp 0 0 0.0.0.0:3128 0.0.0.0:* LISTEN 0 30424 10508/(squid)
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 0 11312 4384/master
tcp 0 0 :::111 :::* LISTEN 0 7711 2997/rpcbind
tcp 0 0 :::6000 :::* LISTEN 0 8129 3176/X
tcp 0 0 :::22 :::* LISTEN 0 11691 4469/sshd
udp 0 0 0.0.0.0:55055 0.0.0.0:* 31 30418 10508/(squid)
udp 0 0 0.0.0.0:3130 0.0.0.0:* 0 30425 10508/(squid)
udp 0 0 0.0.0.0:68 0.0.0.0:* 0 16787 5182/dhclient
udp 0 0 0.0.0.0:39496 0.0.0.0:* 1000 52633 15541/skype
udp 0 0 0.0.0.0:3401 0.0.0.0:* 0 30426 10508/(squid)
udp 0 0 0.0.0.0:5353 0.0.0.0:* 103 9771 4128/avahi-daemon:
udp 0 0 0.0.0.0:111 0.0.0.0:* 0 7636 2997/rpcbind
udp 0 0 0.0.0.0:631 0.0.0.0:* 0 9885 4190/cupsd
udp 0 0 0.0.0.0:35450 0.0.0.0:* 103 9772 4128/avahi-daemon:
udp 0 0 10.0.0.103:123 0.0.0.0:* 74 18789 4333/ntpd
udp 0 0 172.16.25.1:123 0.0.0.0:* 0 10762 4333/ntpd
udp 0 0 172.16.91.1:123 0.0.0.0:* 0 10761 4333/ntpd
udp 0 0 127.0.0.2:123 0.0.0.0:* 0 10760 4333/ntpd
udp 0 0 127.0.0.1:123 0.0.0.0:* 0 10759 4333/ntpd
udp 0 0 0.0.0.0:123 0.0.0.0:* 0 10704 4333/ntpd
udp 0 0 0.0.0.0:1020 0.0.0.0:* 0 7705 2997/rpcbind
udp 0 0 127.0.0.1:35325 0.0.0.0:* 1000 49688 15541/skype
udp 0 0 :::177 :::* 0 8074 3142/gdm
udp 0 0 :::111 :::* 0 7708 2997/rpcbind
udp 0 0 fe80::213:2ff:fe6c::123 :::* 74 18788 4333/ntpd
udp 0 0 fe80::250:56ff:fec0:123 :::* 0 10712 4333/ntpd
udp 0 0 ::1:123 :::* 0 10711 4333/ntpd
udp 0 0 fe80::250:56ff:fec0:123 :::* 0 10710 4333/ntpd
udp 0 0 :::123 :::* 0 10705 4333/ntpd
udp 0 0 :::1020 :::* 0 7710 2997/rpcbind





Linux or UNIX – Find and remove file syntax

3 06 2009

To remove multiple files such as *.jpg or *.sh with one command find, use

find . -name "FILE-TO-FIND"-exec rm -rf {} \;

OR

find . -type f -name "FILE-TO-FIND" -exec rm -f {} \;

The only difference between above two syntax is that first command can remove directories as well where second command only removes files.

More Examples of find command

(a) Find all files having .bak (*.bak) extension in current directory and remove them:
$ find . -type f -name "*.bak" -exec rm -f {} \;

(b) Find all core files and remove them:
# find / -name core -exec rm -f {} \;

(c) Find all *.bak files in current directory and removes them with confirmation from user:
$ find . -type f -name "*.bak" -exec rm -i {} \;





Mount Manual

19 05 2009

Mount Manual

Mounting samba bisa dilakukan secara manual menggunakan konsole. Meski terbilang primitif :-D , cara ini kadang diperlukan untuk memastikan apakah ada suatu kesalahan pada baris perintah yang kita lakukan.

Mount pada folder yang hanya bisa diakses oleh user tertentu (butuh user name dan password)
mount -t cifs //NamaServerSamba-AtauIPAddressSamba/NamaShare /FolderUntukMount/NamaFolder -o username=UserSamba,password=PasswordSamba,iocharset=utf8,file_mode=0777,dir_mode=0777

Contoh :
mount -t cifs //192.168.0.1/Warehouse /home/vavai/Desktop/whs2 -o username=vavai,password=passwordvavai,iocharset=utf8,file_mode=0777,dir_mode=0777

Penjelasan :
- mount -t cifs adalah perintah untuk mount folder Samba. Jika menggunakan distro lain bisa diganti dengan perintah mount -t smbfs

- 192.168.0.1 adalah IP Address Server Samba. Jika menggunakan Nama HostName / Netbios, kita perlu melakukan setting pada file /etc/nsswitch.conf. Ini belum saya bahas pada panduan ini

- Warehouse adalah nama folder share. Nama folder share pada suatu komputer dapat dicheck dengan perintah smb://ip-address-server-samba pada Konqueror

- /home/vavai/Desktop/whs2 adalah nama folder tujuan untuk proses mounting. Folder ini harus sudah ada. Jika belum ada ya harus dibuat.

- -o username=vavai,password=passwordvavai, adalah nama dan password user samba

- iocharset=utf8, untuk memastikan proses konversi huruf / font. Pada komputer dengan font non latin, ada masalah jika opsi ini tidak didefinisikan.

- file_mode=0777,dir_mode=0777, perintah untuk memastikan bahwa folder atau file yang dibuat pada hasil mount bisa diakses dengan modus read dan write.

Cara ini memiliki kekurangan karena username dan password samba dibuat secara plaintext yang artinya bisa dilihat oleh orang lain dengan mudah. Untuk melindunginya, kita bisa menggunakan opsi file credentials, yang menyimpan user name dan password pada suatu file teks yang diletakkan difolder tertentu dan hanya bisa diakses oleh user tertentu.

Caranya adalah dengan membuat file teks, misalnya root/.filecredentials. Tanda titik pada file menunjukkan bahwa file ini berjenis hidden file. Buatlah file tersebut dengan text editor non GUI, misalnya dengan vi. Kenapa tidak dengan GUI Editor, karena file ini harus berisi perintah teks murni tanpa format macam-macam. Isilah file tersebut dengan isi sebagai berikut

username=UserSamba
password=PasswordSamba

Lakukan chmod pada file tersebut agar hanya root yang bisa mengaksesnya, chmod 700 /root/.smbcredentials

Mount pada folder tanpa user name dan password :
mount -t cifs //NamaServerSamba-AtauIPAddressSamba/NamaShare /FolderUntukMount/NamaFolder -o guest,rw,iocharset=utf8,file_mode=0777,dir_mode=0777
Mount dengan akses read only
mount -t cifs //NamaServerSamba-AtauIPAddressSamba/NamaShare /FolderUntukMount/NamaFolder -o guest,iocharset=utf8





Mail command

22 02 2009

Simple way for using command line mail program on Linux:

Syntax:
mail -s “Subject” -a attach_file.txt -r sender@domain -S smtp=ip-of-smtp-address destination@domain < file_of_message_body

Sample:
/usr/bin/mail -s “List logs today” -a /root/logs/listlogs.txt -r backup@domain.net -S smtp=192.168.169.5 adinda@domain.co.id < /root/logs/listlogs.txt

OR The other way is:

Simple Email Message:

echo “Message Body” | mail -s “Subject” receiver@emailaddress.com

Sending File using Linux mail command:

mail -s “Subject” receiver@emailaddress.com < file_to_send.txt

Sending Binary Files with Linux mail command:
Sometimes sending binary files does not work well the command line. We can use uuencode formatting for sending such files:

uuencode myimage.jpeg | mail -s “Subject” receiver@emailaddress.com

Few command line options for Linux mail command:

-s subject ~ Use subject for the e-mail title
-r reply email address ~ email address if you reply to
-c cc email address ~ Send copy of the mail to the specified address
-b bcc emailaddress ~ Send blind carbon copy to specified address
-a attachment file ~ I try just only text file
-S (capital S) for smtp address ~ you could change to other smtp address





Backup with Rsync

19 01 2009

http://rsync.samba.org/ftp/rsync/rsync.html

http://rsync.samba.org/examples.html

http://everythinglinux.org/rsync/

http://www.linux.com/feature/117236

http://www.scrounge.org/linux/rsync.html

http://www.stearns.org/rsync-backup/

http://www.enterprisenetworkingplanet.com/netos/article.php/10951_1573881_3





Wget option for copy site

30 11 2008

To download an entire site, try “wget -rp http://www.indalcorp.com/”.





SQuid – check squid with command line

25 10 2008

Alternatively, you can use the squidclient program that comes with Squid:

% squidclient http://www.squid-cache.org/




SQuid – check configuration file

25 10 2008

Before trying to start Squid, you should verify that your squid.conf file makes sense. This is easy to do. Just run the following command:

% squid -k parse




Download dengan Wget via Proxy by Planet Linux Indonesia

17 10 2008

Download dengan Wget via Proxy

Mungkin ini sudah tak asing lagi yah , download dengan menggunakan wget [option] [URL]. Sebelumnya kita mengedit file /etc/wgetrc . Pada baris ke 78 dan 79 kita ubah dengan url pada proxy kita dengan menghapus ( # ) . Contoh :

http_proxy = http://172.16.15.1:3128
ftp_proxy = http://172.16.15.1:3128

Jangan lupa pada baris ke 82 diubah menjadi dan menghapus ( # ) :

use_proxy = on

Lalu simpan file tersebut shift + wq + enter

Contoh download dengan wget :

http://mirror.pacific.net.au/linux/slackware/slackware-current/slackware/n/wget-1.11.4-i486-1.tgz

option -c menandakan bila terputus bisa di sambung lagi.

Diambil dari : www.ilmunet.info








Follow

Get every new post delivered to your Inbox.