Showing posts with label FTP. Show all posts
Showing posts with label FTP. 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

Perl FTP Test program - Net::FTP - useful for monitoring/ testing

The following is a Perl script that can be used to connect to and list an FTP directory.
This can be extended to accept the paremeters as required - host ip,user password, directory etc.
This also can be run in a loop or from cron to monitor connectivity or to monitor file movements(that is a not so good use!!)

use Net::FTP;
$host = '1x2.1xx.xx.xxx';
$user = 'User';
$pass = 'xxxxxxxxxxx';
$home = '/home/release;
print "Connecting...";
#connect
$ftp = Net::FTP->new($host);
#login
$ftp->login($user,$pass);
print "LoggedIn...";
#slurp
@result = $ftp->ls($home);
print "\nResult...";
for(@result)
{ print "\n";
print $_; }
$ftp->quit;
print "\n...Closed";