Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Sunday, October 10, 2010

Installing and configuring FTP on RHEL - vsftpd

This post explains how to install and run the vsftpd - on Linux
  • Get root in case you are not logged in as root (su - )
  • Try starting vsftpd service

[root@sniff-box ~]# service vsftpd start
vsftpd: unrecognized service

  • If you get this, this means vsftpd is not installed.
  • So install and start. Then test... Note that root would not be given ftp access.

[root@sniff-box ~]# yum install -y vsftpd
Loading "security" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:2.0.5-12.el5 set to be updated
filelists.xml.gz 100% |=========================| 2.8 MB 00:00
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
vsftpd x86_64 2.0.5-12.el5 rhel 136 k
Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 136 k
Downloading Packages:
(1/1): vsftpd-2.0.5-12.el 100% |=========================| 136 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: vsftpd ######################### [1/1]
Installed: vsftpd.x86_64 0:2.0.5-12.el5
Complete!

Installation succeeded - So now try starting the FTP service

[root@sniff-box ~]# service vsftpd start
Starting vsftpd for vsftpd: [ OK ]

Great!! The service is ready for connections.
Try logging in - note that root login does not work - for obvious security reasons.

[root@sniff-box ~]# ftp localhost
Connected to localhost.localdomain.
220 (vsFTPd 2.0.5)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (localhost:root): [root@sniff-box ~]# pwd
/root

Friday, November 14, 2008

Finding lines of text following a text match - awk

Suppose you need to display x lines following a search condition.
For example, display the first 5 lines of trace following an Exception in Tomcat log.

If you are using Solaris/ Linux/ *nix, one way of doing it is to "awk" it.
Get the first five lines after a Keyword named "Exception". Feel free to change the keyword as required.
BEGIN {flag = 0}
/Exception/
{print;
flag = 5;
next}
flag >= 1 {print;
flag--;
next}

Use awk or nawk(if you have a long line - awk has a limitation on line length)
Run it as follows:
nawk -f checkex.awk *
Redirect to a file as follows
nawk -f checkex.awk * > output.txt