Friday, 18 March 2011

FTP SERVER


################################## VSFTPD ########################################################
# In my case 192.168.0.1 is ftp server i have bob and jack with password as password in server.  #
# 192.168.0.2 and 192.168.0.3 is acting as ftp client to ftp server 192.168.0.1 .                #
##################################################################################################
*** To Allow ftp user to download files ******


IN 192.168.0.1 : 
--------------
step 1: install vsftpd package
# yum install vsftpd


step 2: keep the required files in /var/ftp
# touch /var/ftp/f{1..5}


step 3: start vsftpd service.
# service vsftpd restart


step 4: make the service persistant across the reboot.
# chkconfig vsftpd on


IN 192.168.0.2 :
--------------
step 1: check wether ftp user is allowed to download files or not.
# lftp 192.168.0.1
ftp> get f1
ftp> by


*** To Allow ftp user to upload files ****


IN 192.168.0.1 :
---------------
step 1: create a directory may be /var/ftp/upload which is writeable by ftp user.
# mkdir /var/ftp/upload
# chgrp ftp /var/ftp/upload
# chmod g+w /var/ftp/upload


step 2: Allow annonymous user to upload the files in configuration file.
line 27 looks like:
#anon_upload_enable=YES
it should be uncommented and now it should look like:
anon_upload_enable=YES


step 3: restart vsftpd service.
# service vsftpd restart


step 4: make changes in selinux policy to allow anonymous user to upload files
# setsebool -P allow_ftpd_anon_write=1


step 5: change context of directory to allow anonymous user to upload files
# chcon -t public_content_rw_t /var/ftp/upload


IN 192.168.0.2 :
--------------
step 1: create the file which you want to upload.
# touch /root/client1


step 2: check wether ftp user is allowed to upload files or not.
# lftp 192.168.0.1
ftp> cd upload
ftp> put /root/client1
ftp> by


*** To Allow normal user bob with password as password to download and upload files ****


IN 192.168.0.1 :
----------------


step 1: Create user bob with password as password
# useradd bob
# echo "password" | passwd --stdin bob


step 2: keep some files in bob users home dirsectory.
# touch /home/bob/b{1..5}


step 3: change selinux policy so that normal users can get access to their home directories.
# setsebool -P ftp_home_dir=1


IN 192.168.0.2 :
--------------
step 1: create the file which you want to upload.
# touch /root/client2


step 2: check wether bob user is allowed to upload files or not.
# lftp 192.168.0.1 -u bob
passwdord:
ftp> get b1
ftp> put /root/client2
ftp> by


#################################### 

No comments:

Post a Comment