Wednesday, October 14, 2009

How to setup an ftp server on Linux

[root@roni ~]# yum install vsftpd

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: mirror.cs.vt.edu

* updates: mirror.atlanticmetro.net

* addons: chi-10g-1-mirror.fastsoft.net

* extras: updates.interworx.info

Setting up Install Process

Parsing package install arguments

Package vsftpd-2.0.5-12.el5_3.1.i386 already installed and latest version

Nothing to do

[root@roni ~]# vi /etc/vsftpd/vsftpd.conf

Find and edit

xferlog_std_format=NO
log_ftp_protocol=YES
chroot_local_user=YES
banner_file=/etc/vsftpd/issue

to create a message compliant with the local site policy or a legal disclaimer:

[root@roni ~]# vi /etc/vsftpd/issue

NOTICE

Put whatever your message to the user.......

[root@roni ~]# chkconfig vsftpd on

[root@roni ~]# service vsftpd start

Starting vsftpd for vsftpd: [ OK ]

[root@roni ~]# netstat -tulpn | grep :21

tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 29119/vsftpd

[root@roni ~]# vi /etc/sysconfig/iptables

Add this line

RH-Firewall-1-INPUT -m state --state NEW -p tcp --dport 21 -j ACCEPT

[root@roni ~]# vi /etc/sysconfig/iptables-config

Edit

IPTABLES_MODULES="ip_conntrack_ftp"

[root@roni ~]# service iptables restart

to view the log file

[root@roni ~]# tail -f /var/log/vsftpd.log

Wed Jul 8 08:23:01 2009 [pid 2379] [ftp] FTP command: Client "202.148.56.8", "CWD /srv/"

Wed Jul 8 08:23:01 2009 [pid 2379] [ftp] FTP response: Client "202.148.56.8", "550 Failed to change directory."

Wed Jul 8 08:23:01 2009 [pid 2383] [ftp] FTP command: Client "202.148.56.8", "PWD"

Wed Jul 8 08:23:01 2009 [pid 2383] [ftp] FTP response: Client "202.148.56.8", "257 "/""

Wed Jul 8 08:23:01 2009 [pid 2383] [ftp] FTP command: Client "202.148.56.8", "CWD /srv/svn/"

Wed Jul 8 08:23:01 2009 [pid 2383] [ftp] FTP response: Client "202.148.56.8", "550 Failed to change directory."

Wed Jul 8 08:23:02 2009 [pid 2383] [ftp] FTP command: Client "202.148.56.8", "NOOP"

Wed Jul 8 08:23:02 2009 [pid 2383] [ftp] FTP response: Client "202.148.56.8", "200 NOOP ok."

Wed Jul 8 08:23:02 2009 [pid 2383] [ftp] FTP command: Client "202.148.56.8", "CWD /srv/svn/RONI/"


Saturday, October 10, 2009

How to setup an email Server on Linux


login as: root

root@209.190.27.98's password:

Last login: Tue Jul 7 05:21:48 2009 from 202.148.56.8

[root@roni ~]# yum install dovecot

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: mirror.cs.vt.edu

* updates: mirror.atlanticmetro.net

* addons: chi-10g-1-mirror.fastsoft.net

* extras: updates.interworx.info

Setting up Install Process

Parsing package install arguments

Resolving Dependencies

--> Running transaction check

---> Package dovecot.i386 0:1.0.7-7.el5 set to be updated

--> Finished Dependency Resolution

Dependencies Resolved

================================================================================

Package Arch Version Repository Size

================================================================================

Installing:

dovecot i386 1.0.7-7.el5 base 1.6 M

Transaction Summary

================================================================================

Install 1 Package(s)

Update 0 Package(s)

Remove 0 Package(s)

Total download size: 1.6 M

Is this ok [y/N]: y

Downloading Packages:

dovecot-1.0.7-7.el5.i386.rpm | 1.6 MB 00:00

Running rpm_check_debug

Running Transaction Test

Finished Transaction Test

Transaction Test Succeeded

Running Transaction

Installing : dovecot [1/1]

Installed: dovecot.i386 0:1.0.7-7.el5

Complete!

[root@roni ~]# vi /etc/dovecot.conf

Find and change the following options

protocols = pop3 pop3s imap imaps

mail_location = maildir:~/Maildir/

pop3_uidl_format = %08Xu%08Xv

imap_client_workarounds = delay-newmail outlook-idle netscape-eoh

pop3_client_workarounds = outlook-no-nuls oe-ns-eoh

[root@roni ~]# /sbin/service dovecot start

Starting Dovecot Imap: [ OK ]

[root@roni ~]# telnet localhost pop3

Trying 127.0.0.1...

Connected to localhost.localdomain (127.0.0.1).

Escape character is '^]'.

+OK Dovecot ready.

user roni

+OK

pass *****

+OK Logged in.

list

+OK 0 messages:

.

QUIT

+OK Logging out.

Connection closed by foreign host.

[root@roni ~]#

to view the log

[root@roni ~]# vi /var/log/maillog

How to install Java and Tomcat on Linux

[towhid@roni ~]$ wget http://www.java.net/download/jdk6/6u10/promoted/b32/binaries/jre-6u10-rc2-bin-b32-linux-i586-12_sep_2008.bin

--05:00:10-- http://www.java.net/download/jdk6/6u10/promoted/b32/binaries/jre-6u10-rc2-bin-b32-linux-i586-12_sep_2008.bin

Resolving www.java.net... 64.125.132.37, 64.125.132.39

Connecting to www.java.net|64.125.132.37|:80... connected.

HTTP request sent, awaiting response... 301 Moved Permanently

Location: http://download.java.net/jdk6/6u10/promoted/b32/binaries/jre-6u10-rc2-bin-b32-linux-i586-12_sep_2008.bin [following]

--05:00:10-- http://download.java.net/jdk6/6u10/promoted/b32/binaries/jre-6u10-rc2-bin-b32-linux-i586-12_sep_2008.bin

Resolving download.java.net... 72.5.124.114

Connecting to download.java.net|72.5.124.114|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 20034708 (19M) [application/octet-stream]

Saving to: `jre-6u10-rc2-bin-b32-linux-i586-12_sep_2008.bin'

100%[=======================================>] 20,034,708 686K/s in 42s

05:00:53 (462 KB/s) - `jre-6u10-rc2-bin-b32-linux-i586-12_sep_2008.bin' saved [20034708/20034708]

[towhid@roni ~]$ chmod u+x jre-6u10-rc2-bin-b32-linux-i586-12_sep_2008.bin

[towhid@roni ~]$ ./jre-6u10-rc2-bin-b32-linux-i586-12_sep_2008.bin

........................................................

plication-x-java-jnlp-file.png

creating: jre1.6.0_10/lib/desktop/icons/hicolor/48x48/

creating: jre1.6.0_10/lib/desktop/icons/hicolor/48x48/apps/

inflating: jre1.6.0_10/lib/desktop/icons/hicolor/48x48/apps/sun-java.png

inflating: jre1.6.0_10/lib/desktop/icons/hicolor/48x48/apps/sun-javaws.png

inflating: jre1.6.0_10/lib/desktop/icons/hicolor/48x48/apps/sun-jcontrol.png

creating: jre1.6.0_10/lib/desktop/icons/hicolor/48x48/mimetypes/

extracting: jre1.6.0_10/lib/desktop/icons/hicolor/48x48/mimetypes/gnome-mime-text-x-java.png

extracting: jre1.6.0_10/lib/desktop/icons/hicolor/48x48/mimetypes/gnome-mime-application-x-java-archive.png

extracting: jre1.6.0_10/lib/desktop/icons/hicolor/48x48/mimetypes/gnome-mime-application-x-java-jnlp-file.png

creating: jre1.6.0_10/lib/desktop/icons/HighContrast/

creating: jre1.6.0_10/lib/desktop/icons/HighContrast/16x16/

creating: jre1.6.0_10/lib/desktop/icons/HighContrast/16x16/apps/

inflating: jre1.6.0_10/lib/desktop/icons/HighContrast/16x16/apps/sun-java.png

inflating: jre1.6.0_10/lib/desktop/icons/HighContrast/16x16/apps/sun-javaws.png

inflating: jre1.6.0_10/lib/desktop/icons/HighContrast/16x16/apps/sun-jcontrol.png

creating: jre1.6.0_10/lib/desktop/icons/HighContrast/16x16/mimetypes/

inflating: jre1.6.0_10/lib/desktop/icons/HighContrast/16x16/mimetypes/gnome-mime-text-x-java.png

inflating: jre1.6.0_10/lib/desktop/icons/HighContrast/16x16/mimetypes/gnome-mime-application-x-java-archive.png

inflating: jre1.6.0_10/lib/desktop/icons/HighContrast/16x16/mimetypes/gnome-mime-application-x-java-jnlp-file.png

creating: jre1.6.0_10/lib/desktop/icons/HighContrast/48x48/

creating: jre1.6.0_10/lib/desktop/icons/HighContrast/48x48/apps/

inflating: jre1.6.0_10/lib/desktop/icons/HighContrast/48x48/apps/sun-java.png

inflating: jre1.6.0_10/lib/desktop/icons/HighContrast/48x48/apps/sun-javaws.png

inflating: jre1.6.0_10/lib/desktop/icons/HighContrast/48x48/apps/sun-jcontrol.png

creating: jre1.6.0_10/lib/desktop/icons/HighContrast/48x48/mimetypes/

extracting: jre1.6.0_10/lib/desktop/icons/HighContrast/48x48/mimetypes/gnome-mime-text-x-java.png

extracting: jre1.6.0_10/lib/desktop/icons/HighContrast/48x48/mimetypes/gnome-mime-application-x-java-archive.png

extracting: jre1.6.0_10/lib/desktop/icons/HighContrast/48x48/mimetypes/gnome-mime-application-x-java-jnlp-file.png

creating: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/

creating: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/16x16/

creating: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/16x16/apps/

inflating: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/16x16/apps/sun-java.png

inflating: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/16x16/apps/sun-javaws.png

inflating: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/16x16/apps/sun-jcontrol.png

creating: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/16x16/mimetypes/

extracting: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/16x16/mimetypes/gnome-mime-text-x-java.png

extracting: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/16x16/mimetypes/gnome-mime-application-x-java-archive.png

extracting: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/16x16/mimetypes/gnome-mime-application-x-java-jnlp-file.png

creating: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/48x48/

creating: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/48x48/apps/

inflating: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/48x48/apps/sun-java.png

inflating: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/48x48/apps/sun-javaws.png

inflating: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/48x48/apps/sun-jcontrol.png

creating: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/48x48/mimetypes/

extracting: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/48x48/mimetypes/gnome-mime-text-x-java.png

extracting: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/48x48/mimetypes/gnome-mime-application-x-java-archive.png

extracting: jre1.6.0_10/lib/desktop/icons/HighContrastInverse/48x48/mimetypes/gnome-mime-application-x-java-jnlp-file.png

creating: jre1.6.0_10/lib/desktop/icons/LowContrast/

creating: jre1.6.0_10/lib/desktop/icons/LowContrast/16x16/

creating: jre1.6.0_10/lib/desktop/icons/LowContrast/16x16/apps/

extracting: jre1.6.0_10/lib/desktop/icons/LowContrast/16x16/apps/sun-java.png

extracting: jre1.6.0_10/lib/desktop/icons/LowContrast/16x16/apps/sun-javaws.png

extracting: jre1.6.0_10/lib/desktop/icons/LowContrast/16x16/apps/sun-jcontrol.png

creating: jre1.6.0_10/lib/desktop/icons/LowContrast/16x16/mimetypes/

extracting: jre1.6.0_10/lib/desktop/icons/LowContrast/16x16/mimetypes/gnome-mime-text-x-java.png

extracting: jre1.6.0_10/lib/desktop/icons/LowContrast/16x16/mimetypes/gnome-mime-application-x-java-archive.png

extracting: jre1.6.0_10/lib/desktop/icons/LowContrast/16x16/mimetypes/gnome-mime-application-x-java-jnlp-file.png

creating: jre1.6.0_10/lib/desktop/icons/LowContrast/48x48/

creating: jre1.6.0_10/lib/desktop/icons/LowContrast/48x48/apps/

inflating: jre1.6.0_10/lib/desktop/icons/LowContrast/48x48/apps/sun-java.png

inflating: jre1.6.0_10/lib/desktop/icons/LowContrast/48x48/apps/sun-javaws.png

inflating: jre1.6.0_10/lib/desktop/icons/LowContrast/48x48/apps/sun-jcontrol.png

creating: jre1.6.0_10/lib/desktop/icons/LowContrast/48x48/mimetypes/

inflating: jre1.6.0_10/lib/desktop/icons/LowContrast/48x48/mimetypes/gnome-mime-text-x-java.png

inflating: jre1.6.0_10/lib/desktop/icons/LowContrast/48x48/mimetypes/gnome-mime-application-x-java-archive.png

inflating: jre1.6.0_10/lib/desktop/icons/LowContrast/48x48/mimetypes/gnome-mime-application-x-java-jnlp-file.png

creating: jre1.6.0_10/lib/desktop/applications/

inflating: jre1.6.0_10/lib/desktop/applications/sun-java.desktop

inflating: jre1.6.0_10/lib/desktop/applications/sun-javaws.desktop

inflating: jre1.6.0_10/lib/desktop/applications/sun_java.desktop

creating: jre1.6.0_10/lib/desktop/mime/

creating: jre1.6.0_10/lib/desktop/mime/packages/

inflating: jre1.6.0_10/lib/desktop/mime/packages/x-java-archive.xml

inflating: jre1.6.0_10/lib/desktop/mime/packages/x-java-jnlp-file.xml

creating: jre1.6.0_10/lib/locale/

creating: jre1.6.0_10/lib/locale/de/

creating: jre1.6.0_10/lib/locale/de/LC_MESSAGES/

inflating: jre1.6.0_10/lib/locale/de/LC_MESSAGES/sunw_java_plugin.mo

creating: jre1.6.0_10/lib/locale/es/

creating: jre1.6.0_10/lib/locale/es/LC_MESSAGES/

inflating: jre1.6.0_10/lib/locale/es/LC_MESSAGES/sunw_java_plugin.mo

creating: jre1.6.0_10/lib/locale/fr/

creating: jre1.6.0_10/lib/locale/fr/LC_MESSAGES/

inflating: jre1.6.0_10/lib/locale/fr/LC_MESSAGES/sunw_java_plugin.mo

creating: jre1.6.0_10/lib/locale/it/

creating: jre1.6.0_10/lib/locale/it/LC_MESSAGES/

inflating: jre1.6.0_10/lib/locale/it/LC_MESSAGES/sunw_java_plugin.mo

creating: jre1.6.0_10/lib/locale/ja/

creating: jre1.6.0_10/lib/locale/ja/LC_MESSAGES/

inflating: jre1.6.0_10/lib/locale/ja/LC_MESSAGES/sunw_java_plugin.mo

creating: jre1.6.0_10/lib/locale/ko/

creating: jre1.6.0_10/lib/locale/ko/LC_MESSAGES/

inflating: jre1.6.0_10/lib/locale/ko/LC_MESSAGES/sunw_java_plugin.mo

creating: jre1.6.0_10/lib/locale/ko.UTF-8/

creating: jre1.6.0_10/lib/locale/ko.UTF-8/LC_MESSAGES/

inflating: jre1.6.0_10/lib/locale/ko.UTF-8/LC_MESSAGES/sunw_java_plugin.mo

creating: jre1.6.0_10/lib/locale/sv/

creating: jre1.6.0_10/lib/locale/sv/LC_MESSAGES/

inflating: jre1.6.0_10/lib/locale/sv/LC_MESSAGES/sunw_java_plugin.mo

creating: jre1.6.0_10/lib/locale/zh/

creating: jre1.6.0_10/lib/locale/zh/LC_MESSAGES/

inflating: jre1.6.0_10/lib/locale/zh/LC_MESSAGES/sunw_java_plugin.mo

creating: jre1.6.0_10/lib/locale/zh.GBK/

creating: jre1.6.0_10/lib/locale/zh.GBK/LC_MESSAGES/

inflating: jre1.6.0_10/lib/locale/zh.GBK/LC_MESSAGES/sunw_java_plugin.mo

creating: jre1.6.0_10/lib/locale/zh_TW/

creating: jre1.6.0_10/lib/locale/zh_TW/LC_MESSAGES/

inflating: jre1.6.0_10/lib/locale/zh_TW/LC_MESSAGES/sunw_java_plugin.mo

creating: jre1.6.0_10/lib/locale/zh_TW.BIG5/

creating: jre1.6.0_10/lib/locale/zh_TW.BIG5/LC_MESSAGES/

inflating: jre1.6.0_10/lib/locale/zh_TW.BIG5/LC_MESSAGES/sunw_java_plugin.mo

creating: jre1.6.0_10/lib/locale/zh_HK.BIG5HK/

creating: jre1.6.0_10/lib/locale/zh_HK.BIG5HK/LC_MESSAGES/

inflating: jre1.6.0_10/lib/locale/zh_HK.BIG5HK/LC_MESSAGES/sunw_java_plugin.mo

creating: jre1.6.0_10/lib/deploy/

inflating: jre1.6.0_10/lib/deploy/ffjcext.zip

inflating: jre1.6.0_10/lib/deploy/splash.gif

inflating: jre1.6.0_10/lib/deploy/messages.properties

inflating: jre1.6.0_10/lib/deploy/messages_zh_TW.properties

inflating: jre1.6.0_10/lib/deploy/messages_de.properties

inflating: jre1.6.0_10/lib/deploy/messages_es.properties

inflating: jre1.6.0_10/lib/deploy/messages_fr.properties

inflating: jre1.6.0_10/lib/deploy/messages_it.properties

inflating: jre1.6.0_10/lib/deploy/messages_ja.properties

inflating: jre1.6.0_10/lib/deploy/messages_ko.properties

inflating: jre1.6.0_10/lib/deploy/messages_sv.properties

inflating: jre1.6.0_10/lib/deploy/messages_zh_CN.properties

inflating: jre1.6.0_10/lib/deploy/messages_zh_HK.properties

inflating: jre1.6.0_10/lib/deploy/java-icon.ico

inflating: jre1.6.0_10/lib/javaws.pack

inflating: jre1.6.0_10/lib/deploy.pack

inflating: jre1.6.0_10/lib/jsse.pack

inflating: jre1.6.0_10/lib/charsets.pack

inflating: jre1.6.0_10/COPYRIGHT

inflating: jre1.6.0_10/Welcome.html

inflating: jre1.6.0_10/README

inflating: jre1.6.0_10/LICENSE

creating: jre1.6.0_10/man/

creating: jre1.6.0_10/man/man1/

inflating: jre1.6.0_10/man/man1/java.1

inflating: jre1.6.0_10/man/man1/keytool.1

inflating: jre1.6.0_10/man/man1/rmid.1

inflating: jre1.6.0_10/man/man1/rmiregistry.1

inflating: jre1.6.0_10/man/man1/tnameserv.1

inflating: jre1.6.0_10/man/man1/servertool.1

inflating: jre1.6.0_10/man/man1/orbd.1

inflating: jre1.6.0_10/man/man1/policytool.1

inflating: jre1.6.0_10/man/man1/pack200.1

inflating: jre1.6.0_10/man/man1/unpack200.1

inflating: jre1.6.0_10/man/man1/javaws.1

linking: jre1.6.0_10/man/ja -> ja_JP.eucJP

creating: jre1.6.0_10/man/ja_JP.eucJP/

creating: jre1.6.0_10/man/ja_JP.eucJP/man1/

inflating: jre1.6.0_10/man/ja_JP.eucJP/man1/java.1

inflating: jre1.6.0_10/man/ja_JP.eucJP/man1/keytool.1

inflating: jre1.6.0_10/man/ja_JP.eucJP/man1/rmid.1

inflating: jre1.6.0_10/man/ja_JP.eucJP/man1/rmiregistry.1

inflating: jre1.6.0_10/man/ja_JP.eucJP/man1/tnameserv.1

inflating: jre1.6.0_10/man/ja_JP.eucJP/man1/servertool.1

inflating: jre1.6.0_10/man/ja_JP.eucJP/man1/orbd.1

inflating: jre1.6.0_10/man/ja_JP.eucJP/man1/policytool.1

inflating: jre1.6.0_10/man/ja_JP.eucJP/man1/pack200.1

inflating: jre1.6.0_10/man/ja_JP.eucJP/man1/unpack200.1

inflating: jre1.6.0_10/man/ja_JP.eucJP/man1/javaws.1

creating: jre1.6.0_10/plugin/

creating: jre1.6.0_10/plugin/i386/

creating: jre1.6.0_10/plugin/i386/ns7/

inflating: jre1.6.0_10/plugin/i386/ns7/libjavaplugin_oji.so

creating: jre1.6.0_10/plugin/i386/ns7-gcc29/

inflating: jre1.6.0_10/plugin/i386/ns7-gcc29/libjavaplugin_oji.so

creating: jre1.6.0_10/plugin/desktop/

extracting: jre1.6.0_10/plugin/desktop/sun_java.png

inflating: jre1.6.0_10/plugin/desktop/sun_java.desktop

creating: jre1.6.0_10/javaws/

linking: jre1.6.0_10/javaws/javaws -> ../bin/javaws

Creating jre1.6.0_10/lib/rt.jar

Creating jre1.6.0_10/lib/jsse.jar

Creating jre1.6.0_10/lib/charsets.jar

Creating jre1.6.0_10/lib/ext/localedata.jar

Creating jre1.6.0_10/lib/plugin.jar

Creating jre1.6.0_10/lib/javaws.jar

Creating jre1.6.0_10/lib/deploy.jar

Done.

[towhid@roni ~]$ su

Password:******

[root@roni towhid]# mv jre1.6.0_10 /usr/lib/

[root@roni towhid]# echo "export JAVA_HOME=/usr/lib/jre" >> ~/.bashrc

[root@roni towhid]# echo "export PATH=$JAVA_HOME/bin:$PATH" >> ~/.bashrc

[root@roni towhid]# wget http://download.nextag.com/apache/tomcat/tomcat-5/v5.5.27/bin/apache-tomcat-5.5.27.tar.gz

--05:10:40-- http://download.nextag.com/apache/tomcat/tomcat-5/v5.5.27/bin/apache-tomcat-5.5.27.tar.gz

Resolving download.nextag.com... 216.185.208.5

Connecting to download.nextag.com|216.185.208.5|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 6478912 (6.2M) [application/x-gzip]

Saving to: `apache-tomcat-5.5.27.tar.gz'

100%[=======================================>] 6,478,912 1.25M/s in 5.3s

05:10:46 (1.15 MB/s) - `apache-tomcat-5.5.27.tar.gz' saved [6478912/6478912]

[root@roni towhid]# tar -xzf apache-tomcat-5.5.27.tar.gz

[root@roni towhid]# mv apache-tomcat-5.5.27 /opt/tomcat-5.5

[root@roni towhid]# echo "export CATALINA_HOME=/opt/tomcat-5.5" >> ~/.bashrc

[root@roni towhid]# echo "CATALINA_BASE=/opt/tomcat-5.5" >> ~/.bashrc

@decorators in Python

People have confusion about how to use python decorators in the proper way and how it works. The main reason for it is there are several way...