In this post i will show you how to download and upload files in windows as client and linux as server through ftp server . In my previous ftp post i have shown you guys how to download and upload files in linux through ftp . And how to only download files in ftp if windows is client . But not shown how to upload in windows using ftp client .
- First install required packages for ftp server ( vsftpd )
[root@deepitp5 ~]# yum install vsftpd* -y Loaded plugins: rhnplugin, security Repository 'a' is missing name in configuration, using id This system is not registered with RHN. RHN support will be disabled. a | 1.3 kB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package vsftpd.i386 0:2.0.5-16.el5 set to be updated a/filelists | 2.3 MB 00:00 --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================== Package Arch Version Repository Size ============================================================================================================== Installing: vsftpd i386 2.0.5-16.el5 a 140 k Transaction Summary ============================================================================================================== Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 140 k Downloading Packages: Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : vsftpd 1/1 Installed: vsftpd.i386 0:2.0.5-16.el5 Complete!
- Now open ftp configuration file through vim
[root@deepitp5 ~]# vim /etc/vsftpd/vsftpd.conf
- Press ESC and type :set number ( to view lines in number )
- Like this i have shown below .
1 # Example config file /etc/vsftpd/vsftpd.conf 2 # 3 # The default compiled in settings are fairly paranoid. This sample file 4 # loosens things up a bit, to make the ftp daemon more usable. 5 # Please see vsftpd.conf.5 for all compiled in defaults. 6 # 7 # READ THIS: This example file is NOT an exhaustive list of vsftpd options. 8 # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's 9 # capabilities. 10 # 11 # Allow anonymous FTP? (Beware - allowed by default if you comment this out). 12 anonymous_enable=YES 13 # 14 # Uncomment this to allow local users to log in. 15 local_enable=YES 16 # 17 # Uncomment this to enable any form of FTP write command. 18 write_enable=YES 19 # 20 # Default umask for local users is 077. You may wish to change this to 022, 21 # if your users expect that (022 is used by most other ftpd's) 22 local_umask=022 23 # 24 # Uncomment this to allow the anonymous FTP user to upload files. This only 25 # has an effect if the above global write enable is activated. Also, you will 26 # obviously need to create a directory writable by the FTP user. 27 #anon_upload_enable=YES 28 # 29 # Uncomment this if you want the anonymous FTP user to be able to create 30 # new directories. 31 #anon_mkdir_write_enable=YES 32 # 33 # Activate directory messages - messages given to remote users when they 34 # go into a certain directory. 35 dirmessage_enable=YES
- Now come to line 27 and 31 .
- Press “ I ” ( insert mode ) and remove hash ( # ) from those lines
27 anon_upload_enable=YES 28 # 29 # Uncomment this if you want the anonymous FTP user to be able to create 30 # new directories. 31 anon_mkdir_write_enable=YES
- Press ESC and type :wq ( to save and quit )
- Disable linux firewall and se linux settings .
- First command is to disable the linux firewall
- Second command is to disable se linux settings .
[root@deepitp5 ~]# iptables -F [root@deepitp5 ~]# setenforce 0
- Allow permission to ftp folder by typing below command .
[root@deepitp5 ~]# chmod -R 777 /var/ftp/
- Now start the ftp service .
[root@deepitp5 ~]# service vsftpd restart Shutting down vsftpd: [FAILED] Starting vsftpd for vsftpd: [ OK ]
- Also get the ip address of server mahcine .
- Like my ip address is 192.168.1.106
[root@deepitp5 ~]# ip a
eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000 link/ether 08:00:27:f8:4a:4c brd ff:ff:ff:ff:ff:ff inet 192.168.1.106/24 brd 192.168.1.255 scope global eth1 inet6 fe80::a00:27ff:fef8:4a4c/64 scope link valid_lft forever preferred_lft forever
NOW COMES THE CLIENT ROLE
- Open my computer
- Now in address bar type ftp://ip address of server machine
- Like my ip address ids 192.168.1.106 . So i have written ftp://192.168.1.106
- This login window will pop up on your screen .
- Type username and password to login to connect to server machine through ftp .
- Now copy the any file from windows ( client ) system .
- And paste it here . This is upload .FOR download you can copy file from this folder and paste in your system .
- Now in server machine .
- Go to deepit user folder in /home
- Type ls command and you will find all uploaded files have been successfully uploaded.
[root@deepitp5 ~]# cd /home/ [root@deepitp5 home]# ls deepit [root@deepitp5 home]# cd deepit/ [root@deepitp5 deepit]# ls ferrari_458_spider-wallpaper-1366x768.jpg VA - Non-Stop Party Hits [Club Mix] [Mw Hits].mp3
- Now to stop the service type command shown below .
[root@deepitp5 ~]# service vsftpd stop Shutting down vsftpd: [ OK ]