{"id":4929,"date":"2015-07-18T12:18:31","date_gmt":"2015-07-18T04:18:31","guid":{"rendered":"http:\/\/rmohan.com\/?p=4929"},"modified":"2015-07-18T13:26:04","modified_gmt":"2015-07-18T05:26:04","slug":"vsftp-on-centos6-6","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=4929","title":{"rendered":"vsftp on CentOS6.6"},"content":{"rendered":"<p>CentOS6.6<\/p>\n<p>2?vsftpd-2.2.2<\/p>\n<p>Second, the installation<\/p>\n<p>$ yum install -y vsftpd<\/p>\n<p>[root@oracledbserver mohan]# yum install vsftpd<br \/>\nLoaded plugins: fastestmirror, refresh-packagekit, security<br \/>\nSetting up Install Process<br \/>\nLoading mirror speeds from cached hostfile<br \/>\n * base: mirror.vodien.com<br \/>\n * extras: mirror.vodien.com<br \/>\n * updates: mirror.vastspace.net<br \/>\nbase                                                                                                                                                                                 | 3.7 kB     00:00<br \/>\nextras                                                                                                                                                                               | 3.4 kB     00:00<br \/>\nupdates                                                                                                                                                                              | 3.4 kB     00:00<br \/>\nResolving Dependencies<br \/>\n&#8211;> Running transaction check<br \/>\n&#8212;> Package vsftpd.x86_64 0:2.2.2-13.el6_6.1 will be installed<br \/>\n&#8211;> Finished Dependency Resolution<\/p>\n<p>Dependencies Resolved<\/p>\n<p>============================================================================================================================================================================================================<br \/>\n Package                                       Arch                                          Version                                                   Repository                                      Size<br \/>\n============================================================================================================================================================================================================<br \/>\nInstalling:<br \/>\n vsftpd                                        x86_64                                        2.2.2-13.el6_6.1                                          updates                                        151 k<\/p>\n<p>Transaction Summary<br \/>\n============================================================================================================================================================================================================<br \/>\nInstall       1 Package(s)<\/p>\n<p>Total download size: 151 k<br \/>\nInstalled size: 332 k<br \/>\nIs this ok [y\/N]: y<br \/>\nDownloading Packages:<br \/>\nvsftpd-2.2.2-13.el6_6.1.x86_64.rpm                                                                                                                                                   | 151 kB     00:00<br \/>\nRunning rpm_check_debug<br \/>\nRunning Transaction Test<br \/>\nTransaction Test Succeeded<br \/>\nRunning Transaction<br \/>\n  Installing : vsftpd-2.2.2-13.el6_6.1.x86_64                                                                                                                                                           1\/1<br \/>\n  Verifying  : vsftpd-2.2.2-13.el6_6.1.x86_64                                                                                                                                                           1\/1<\/p>\n<p>Installed:<br \/>\n  vsftpd.x86_64 0:2.2.2-13.el6_6.1<\/p>\n<p>Complete!<\/p>\n<p>Third, the configuration<\/p>\n<p>$ vi \/etc\/vsftpd\/vsftpd.conf<\/p>\n<p>isten_address=192.168.1.61<br \/>\nlisten_port=21 # specified listening port<br \/>\nanonymous_enable=NO<br \/>\nlocal_enable=YES<br \/>\nwrite_enable=YES<br \/>\nlocal_umask=022 # local user to upload a file mask<br \/>\ndirmessage_enable=YES<br \/>\nxferlog_enable=YES<br \/>\nconnect_from_port_20=YES<br \/>\nxferlog_file=\/var\/log\/xferlog<br \/>\nxferlog_std_format=YES<br \/>\nftpd_banner=Welcome to Mohan FTP service.<br \/>\nchroot_local_user=YES<br \/>\nchroot_list_enable=YES<br \/>\nchroot_list_file=\/etc\/vsftpd\/chroot_list<br \/>\nlisten=YES<br \/>\npam_service_name=vsftpd<br \/>\nuserlist_enable=YES<br \/>\nuserlist_deny=YES<br \/>\ntcp_wrappers=YES<br \/>\nuserlist_file=\/etc\/vsftpd\/user_list<br \/>\npasv_enable=YES<br \/>\npasv_min_port=65400<br \/>\npasv_max_port=65410<\/p>\n<p>listen_address=192.168.1.61                  # specified listen address<br \/>\nlisten_port=21 # specified listening port<br \/>\nanonymous_enable=NO # does not allow anonymous access<br \/>\nlocal_enable=YES # allow local users<br \/>\nwrite_enable=YES # allowed to upload<br \/>\nlocal_umask=022 # local user to upload a file mask<br \/>\ndirmessage_enable=YES #<br \/>\nxferlog_enable=YES # Enable the log<br \/>\nconnect_from_port_20=YES # 20-port connection using ftp<br \/>\nxferlog_file=\/var\/log\/xferlog # specified log file location<br \/>\nxferlog_std_format=YES # specify the log format to standard output<br \/>\nchroot_local_user=YES # Allow Directory Jump<br \/>\nchroot_list_enable=YES # allow the user to specify the file directory permissions Jump<br \/>\nchroot_list_file=\/etc\/vsftpd\/chroot_list # in the file specifies the user can jump<br \/>\nlisten=YES # allows you to specify the listener<br \/>\npam_service_name=vsftpd # define pam module file name (The module may not be used, has been userlist substitute)<br \/>\nuserlist_enable=YES # allowed to file in the user login<br \/>\nuserlist_deny=NO # specified file in addition to the user can log in, the other not and will not allow<br \/>\nuserlist_file=\/etc\/vsftpd\/user_list # In this configuration file to specify which users can log on<br \/>\ntcp_wrappers=YES # allows the firewall to allow and block specific ip<br \/>\npasv_enable=YES # run in passive mode<br \/>\npasv_min_port=65400 # assign the starting port<br \/>\npasv_max_port=65410 # distribution end port<\/p>\n<p>Fourth, run<br \/>\n$ chkconfig vsftpd on<br \/>\n$ chkconfig &#8211;list vsftpd<br \/>\nvsftpd            0:off    1:off    2:on    3:on    4:on    5:on    6:off<br \/>\n$ \/etc\/init.d\/vsftpd start<br \/>\n \/etc\/init.d\/vsftpd Start<br \/>\n$ setenforce 0 or echo &#8220;SELINUX=disabled&#8221;> \/etc\/selinux\/config (restart to take effect)<\/p>\n<p># Develop a data port 21 and port 20 will automatically open<\/p>\n<p>$ iptables -A INPUT -m state &#8211;state NEW -m tcp -p tcp &#8211;dport 21 -j ACCEPT<\/p>\n<p>Port # open passive mode<br \/>\n$ iptables -A INPUT -m state &#8211;state NEW -p tcp &#8211;dport 65400:65410 -j ACCEPT<br \/>\n$ useradd mohan -s \/sbin\/nologin<br \/>\n$ echo &#8220;mohan&#8221;|passwd mohan123 &#8211;stdin  <\/p>\n<p>Fifth, check<\/p>\n<p>Six customers to upload test<\/p>\n<p># Install the client<br \/>\n$ Yum install -y ftp<\/p>\n<p>Configuring FTP server and Restricting their access<\/p>\n<p>Configuration FTP server: <\/p>\n<p>VSFTPD is responsible for the FTP service.<\/p>\n<p>open: \/etc\/vsftpd\/vsftpd.conf<\/p>\n<p>Change Configuration File: vsftpd.conf<\/p>\n<p>###Allow anonymous FTP? (Beware \u2013 allowed by default if you comment this out).<\/p>\n<p>#Restrict Annonomous Users to be logged in<\/p>\n<p>anonymous_enable=NO<\/p>\n<p>### Restrict the ftp users to their home directories<\/p>\n<p>chroot_local_user=YES<\/p>\n<p>~~Save &#038; Close<\/p>\n<p># If userlist_deny=NO, only allow users in this file<br \/>\n # If userlist_deny=YES (default), never allow users in this file<\/p>\n<p>#### Restrict specific users to use ftp. <\/p>\n<p>open: vi user_list <\/p>\n<p># If userlist_deny=NO, only allow users in this file<br \/>\n # If userlist_deny=YES (default), never allow users in this file, and<br \/>\n # do not even prompt for a password.<br \/>\n # Note that the default vsftpd pam config also checks \/etc\/vsftpd\/ftpusers<br \/>\n # for users that are denied.<br \/>\n # Users that are not allowed to login via ftp<\/p>\n<p>add user names not allowed to use ftp access<\/p>\n<p>Open: \/etc\/vsftpd\/ftpusers<\/p>\n<p>By adding the name of the users we can restrict or, allow any user to use ftp <\/p>\n<p>~~Save &#038; Close<\/p>\n<p>#####Creating a group to give access ftp access &#038; Creating Home Directories to be restricted: <\/p>\n<p># creating groups:<\/p>\n<p>groupadd ftp-usrs<\/p>\n<p># creating a home directories:<\/p>\n<p>Creating An FTP server: <\/p>\n<p>###VSFTPD is responsible for the FTP service.<\/p>\n<p>open: \/etc\/vsftpd\/vsftpd.conf<\/p>\n<p>Change Configuration File: vsftpd.conf<\/p>\n<p>### Allow anonymous FTP? (Beware \u2013 allowed by default if you comment this out).<\/p>\n<p>#Restrict Annonomous Users to be logged in<\/p>\n<p>anonymous_enable=NO<\/p>\n<p>### Restrict the ftp users to their home directories<\/p>\n<p>chroot_local_user=YES<\/p>\n<p>~~Save &#038; Close<\/p>\n<p># If userlist_deny=NO, only allow users in this file<br \/>\n # If userlist_deny=YES (default), never allow users in this file<\/p>\n<p>### Restrict specific users to use ftp. <\/p>\n<p>open: vi user_list <\/p>\n<p># If userlist_deny=NO, only allow users in this file<br \/>\n # If userlist_deny=YES (default), never allow users in this file, and<br \/>\n # do not even prompt for a password.<br \/>\n # Note that the default vsftpd pam config also checks \/etc\/vsftpd\/ftpusers<br \/>\n # for users that are denied.<br \/>\n # Users that are not allowed to login via ftp<\/p>\n<p>add user names not allowed to use ftp access<\/p>\n<p>Open: \/etc\/vsftpd\/ftpusers<\/p>\n<p>By adding the name of the users we can restrict or, allow any user to use ftp <\/p>\n<p>~~Save &#038; Close<\/p>\n<p>#####Creating a group to give access ftp access &#038; Creating Home Directories to be restricted: <\/p>\n<p># creating groups:<\/p>\n<p>groupadd ftp-usrs<\/p>\n<p># creating a home directories:<br \/>\n mkdir \/home\/ftp-docs<br \/>\n man chmod<br \/>\n chmod 750 \/home\/ftp-docs<br \/>\n chown root:ftp-usrs \/home\/ftp-docs<\/p>\n<p># creating users to be entered in the specific group: <\/p>\n<p>usradd -g ftp-usrs -d \/home\/ftp-docs f1<br \/>\n passwd f1<\/p>\n<p>##### Restricting sftp service to limited groups: <\/p>\n<p>open: \/etc\/ssh\/sshd_config<\/p>\n<p>#### Deny groups or, users who cant not use the sftp protocols<\/p>\n<p>#write: <\/p>\n<p>DenyUsers alice f1<br \/>\n DenyGroups ftp-usrs<\/p>\n<p>#Allowing groups or, users access<\/p>\n<p>write: <\/p>\n<p>AllowUsers alice f1<br \/>\n AllowGroups ftp-usrs<\/p>\n<p>~~Save &#038; Close<\/p>\n<p>@@@@@@<\/p>\n<p>Restart ftp &#038; stfp service<\/p>\n<p>service vsftpd restart<\/p>\n<p>\/etc\/init.d\/sshd restart<\/p>\n<p>!!!!!!!!<\/p>\n<p>Access the file by restricted ftp &#038; sftp service<\/p>\n<p>mkdir \/home\/ftp-docs<br \/>\n man chmod<br \/>\n chmod 750 \/home\/ftp-docs<br \/>\n chown root:ftp-usrs \/home\/ftp-docs<\/p>\n<p># creating users to be entered in the specific group: <\/p>\n<p>usradd -g ftp-usrs -d \/home\/ftp-docs f1<br \/>\n passwd f1<\/p>\n<p>##### Restricting sftp service to limited groups: <\/p>\n<p>open: \/etc\/ssh\/sshd_config<\/p>\n<p>#### Deny groups or, users who cant not use the sftp protocols<\/p>\n<p>#write: <\/p>\n<p>DenyUsers alice f1<br \/>\n DenyGroups ftp-usrs<\/p>\n<p>#Allowing groups or, users access<\/p>\n<p>write: <\/p>\n<p>AllowUsers alice f1<br \/>\n AllowGroups ftp-usrs<\/p>\n<p>~~Save &#038; Close<\/p>\n<p>@@@@@@<\/p>\n<p>Restart ftp &#038; stfp service<\/p>\n<p>service vsftpd restart<\/p>\n<p>\/etc\/init.d\/sshd restart<\/p>\n<p>!!!!!!!!<\/p>\n<p>Access the file by restricted ftp &#038; sftp service<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CentOS6.6<\/p>\n<p>2?vsftpd-2.2.2<\/p>\n<p>Second, the installation<\/p>\n<p>$ yum install -y vsftpd<\/p>\n<p>[root@oracledbserver mohan]# yum install vsftpd Loaded plugins: fastestmirror, refresh-packagekit, security Setting up Install Process Loading mirror speeds from cached hostfile * base: mirror.vodien.com * extras: mirror.vodien.com * updates: mirror.vastspace.net base | 3.7 kB 00:00 extras | 3.4 kB 00:00 updates | 3.4 kB 00:00 Resolving [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,14,4],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4929"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4929"}],"version-history":[{"count":4,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4929\/revisions"}],"predecessor-version":[{"id":4933,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4929\/revisions\/4933"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}