Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Setup and Configure Basic E-mail Server

Follow the instruction to setup and configure basic E-mail Server

1. Start two terminal shells, one as root on desktopX, the other as root on serverX

2. On each machine, confirm that postfix and mutt packages are installed and that the
   postfix service is running.

   # yum install -y postfix mutt
   # service postfix status
 
3. On serverX, add the user elvis. Become elvis and open the mutt MUA to monitor
   incoming mail.
 
   # useradd elvis
   # yum install -y mutt
   # su - elvis
   $ mutt

4. Use the mutt MUA on desktopX to compose and send mail to elvis@serverX.example.com.

   Press m in mutt to compose a new message. Enter elvis@serverX.example.com in the
   To: field. Enter Test as the subject.Enter a few words in the body and save and exit
   (it opened the file in vi). Press y t send to mail.

5. Did elvis receive e-mail on serverX? check it

6. On desktopX use mailq to examine the delivery queue.Also browse /ver/log/maillog to
   look for any problems.

   # mailq
   # tail /var/log/maillog

7. On serverX, recall that postfix binds to localhost only be default according to Red Hat
   policy. Use netstat to confirm this is the case.

   # netstat -tuln | grep :25

8. Examine the current settings of the inet_interfaces directive in the main postfix
   configuration file /etc/postfix/main.cf

   # grep inet_interfaces /etc/postfix/main.cf

9. Edit /etc/postfix/main.cf. Find the line that has inet_interfaces = localhost and
   change it to inte_interfaces = all. Restart the postfix service and confirm the
   deamon is listening on all interface.

   # service postfix restart
   # netstat -tuln | grep :25

10.ON desktopX use postfix flush to manually flush the pending delivery queue.Confirm
   that the queue is now empty and that the mail was successfully delivered.
 
   # postfix flush
   # mailq
   # tail /var/log/maillog

11.On serverX use the mutt MUA to confirm e-mail delivery. Also examine /var/log/maillog
   for evidence the mail was successfully delivered.
 
   # mutt
   # tail /var/log/maillog

-- Happy E-mailing

Related topic:
                      Basic E-mail Delivery
                      Key e-mail delivery concepts
                      The postfix MTA
                      

FTP Server Configuration

FTP Server Configuration


Most common FTP server configuration is an anonymous-only FTP server that only allows the anonymous client to download files, and disables all local users and uploads. In order to configure this, some changes will need to be made to the vsftpd configuration.

An FTP deployment best practice is to turn off local user access. When users authenticate to transfer files to /from a system with FTP, their account names and passwords are vulnerable to an eavesdropping attacker. (If secure file transfer is needed by users, the rsync command over SSH, or the SFTP service provided by sshd are better choices.) Anonymous FTP by its nature is public, and files provided through anonymous FTP are assumed to be public and not sensitive.

The vsftpd configuration file is found in  /etc/vsftpd/vsftpd.conf and the document root is found in /var/ftp/. When you make changes to the FTP server, do not forget to restart the service.
Make user you understand the following options:

Anonymous_enable=YES: enables the anonymous ftp server
Local_enable=NO: disable all non-anonymous local user accounts

Write_enable=NO: disable any user from uploading files to the FTP server

--- Cheers !!!

Deploy an FTP Server

FTP, the file Transfer Protocol, is one of the oldest network protocols still in common use on the Internet. It provides a simple way for systems to transfer files to and from a remote server over the network.
The name of the FTP server package in Red Hat Enterprise Linux 6 is vsftpd, which stands for Very Secure File Transfer Protocol Daemon. The server name is also called vsftpd.


Deploy an FTP server. Verify it is working and enabled.

Step 1: Install the vsftpd package.
            # yum install vsftpd*
Or
Go to: System  à Administration à Add/Remove Software.
Type vsftp then the find button.
Ensure that Very Secure Ftp Daemon has check mark and then click the Apply button.
Step 2: Start the vsftpd service
            # /etc/init.d/vsftpd restart
Or
Go to: System à Administration à Services. Find and highlight the vsftpd entry in the list on the left.
Click on the Start button up above.
Step3: Enable the vsftpd service
            #chkconfig vsftpd on
Or
Go to: System àAdministration àServices. Find and highlighted the vsftpd entry in the list on the left.
Click on the Enable button up above.
Step4: Publish a copy of /etc/hosts to the anonymous FTP document root.
Us Nautilus(as root) to copy  /etc/hosts to the  /var/ftp/ directory.

Step5: Test the FTP server on desktop with an ftp client(Nautilus) to connect to the server

The default configuration file supports anonymous download-only access to a chrooted tree located at /var/ftp/. This means that,
1. A remote FTP client can connect to the server as user anonymous or ftp with no password
2. Download files from the /var/ftp directory on the FTP server which are readable by its local ftp user.
3. It also permits users on the system to connect with their password, download any files on the system they can read, and upload files to any location on the system they can write.

4. If you plan to use the FTP server for above describe purpose, the default configuration settings are reasonable and do not need to be changed.

--- cheers !!!

Introduction to vim


VIM (vi Improved) is a powerful text editor which is more sophisticated than gedit. Also, unlike gedit, you can always expect vim (or its predecessor, vi) to be available in any Linux system.
The vim editor supports sophisticated text manipulations which are very useful for system administration. In fact, if you are familiar with the vi utility, you will find that vim includes vi features, plus many other features such as split screen editing, color formatting of known file types, and text highlighting for copying and changing text, to name a few.
One reason why vim is powerful but tricky to learn is that it is a modal editor; it works differently depending on which mode it is in. There are three modes you need to know to start with: normal mode(also called command mode), insert mode, and ex mode.

Primary vim Modes
  1. Command mode is used for file navigation, cut and paste, and simple commands.
  2.  Insert mode is used for normal text editing.
  3.  Ex mode is used to save, quit, search and replace, and perform other complex operations.

Command Mode
After opening the vim editor, you begin in command mode. This is the basic mode you return to when done with an edit and preparing to save, search and replace text, or perform other operations. In this mode, you can move around the file (using PageUp, pageDown, or arrow keys), and typing characters can execute many different commands to do such things as selecting, copying, or pasting text. One useful command here is u, to undo the last change. If you are confused about what mode vim is in, you can type Esc a couple of times to command mode.

Insert Mode
From command mode, press the I key to go into insert mode at the cursor’s current position. Then you can begin entering text. You can use the arrow keys to move the cursor in vim while remaining in insert mode. Press the Esc key to leave insert and return to command mode.

Ex Mode
From command mode, press a: character to go into ex mode and the cursor moves to the bottom of the screen. Press : q(to quit) :w(to write changes to the file), or :wq to write and quit. Use the ! character to override a default action. For example :q! lets you quit without saving and :w! lets you overwrite a read-only file (if you own it). Other commands are available in ex mode, including an on-line help system under :help.


----------x--------