HOWTO Setup vsftpd: Difference between revisions

From Research
Jump to navigation Jump to search
Jjaythomas (talk | contribs)
No edit summary
Jjaythomas (talk | contribs)
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 2: Line 2:


  <font color=red>server / #</font> <font color=blue>emerge --sync</font>
  <font color=red>server / #</font> <font color=blue>emerge --sync</font>


Install vstfpd:
Install vstfpd:


  <font color=red>server / #</font> <font color=blue>emerge -v vsftpd</font>
  <font color=red>server / #</font> <font color=blue>emerge -v vsftpd</font>
Copy the example configuration file as your template:


<font color=red>server / #</font> <font color=blue>cp /etc/vsftpd/vsftpd.conf.example /etc/vsftpd/vsftpd.conf</font>


cp /etc/vsftpd/vsftpd.conf.example /etc/vsftpd/vsftpd.conf
   
 
Edit the configuration file with these additional switches:
  <font color=red>server / #</font> <font color=blue>cp /etc/vsftpd/user_list</font>
 
 
vi /etc/vsftpd/vsftpd.conf


  <font color=red>server / # vi</font> <font color=blue>/etc/vsftpd/vsftpd.conf</font>  
  <font color=red>server / #</font> <font color=blue>vi /etc/vsftpd/vsftpd.conf</font>  




Line 46: Line 45:




  <font color=red>server / # vi</font> <font color=blue>/etc/vsftpd/user_list</font>  
Enter user names who will be permitted to access the site:
 
  <font color=red>server / #</font> <font color=blue>vi /etc/vsftpd/user_list</font>
 
Populate this file with the same values:
 
<font color=red>server / #</font> <font color=blue>vi /etc/vsftpd/vsftpd.ftpusers</font>  
 
Start vsftpd at boot:


rc-update vsftpd add default
<font color=red>server / #</font> <font color=blue>rc-update vsftpd add default</font>  
<font color=red>server / # vi</font> <font color=blue>/etc/vsftpd/user_list</font>  


Start vsftpd:


/etc/init.d/vsftpd start
<font color=red>server / #</font> <font color=blue>/etc/init.d/vsftpd start</font>  
<font color=red>server / # vi</font> <font color=blue>/etc/vsftpd/user_list</font>  




* check for the presence of home directories, which vsftp uses as default
* check for the presence of home directories, which vsftp uses as default.
* no login is allowed to a user who does not have a home directory stipulated.




Line 63: Line 70:
==Set Up User(s) For Web directory FTP Access==
==Set Up User(s) For Web directory FTP Access==


Edit the home directory path of the user:


vi /etc/passwd
<font color=red>server / #</font> <font color=blue>vi /etc/passwd</font>


UserName:x:1001:1002::/var/www/www.web.iat.sfu.ca/:/bin/bash
UserName:x:1001:1002::/var/www/www.web.iat.sfu.ca/:/bin/bash


groupadd ftpaccess


usermod -g ftpaccess UserName
Add a group to allow access to web directory:
 
<font color=red>server / #</font> <font color=blue>groupadd ftpaccess</font>
 
Add user name to web directory group
 
<font color=red>server / #</font> <font color=blue>usermod -a -G ftpaccess UserName</font>
 
Set appropriate rights to the web directory:
 
<font color=red>server / #</font> <font color=blue>chmod -R 775 www.web.iat.sfu.ca/</font>
 
Recursively change the group of the web directory:
 
<font color=red>server / #</font> <font color=blue>chgrp -R ftpaccess www.web.iat.sfu.ca/</font>
 
Stop and start Apache:


chmod -R 775 www.web.iat.sfu.ca/
<font color=red>server / #</font> <font color=blue>/etc/init.d/apache stop start</font>


chgrp -R ftpaccess www.web.iat.sfu.ca/
Stop and start vsftpd:


/etc/init.d/apache stop start
<font color=red>server / #</font> <font color=blue>/etc/init.d/vsftpd stop start</font>


/etc/init.d/vsftpd stop start




==Troubleshooting Syntax==
==Troubleshooting Commands==


This command will display your vsftpd configuation:


grep -vE "^#" /etc/vsftpd/*
<font color=red>server / #</font> <font color=blue>grep -vE "^#" /etc/vsftpd/*</font>

Latest revision as of 15:48, 12 March 2008

First, get the latest version in your portage tree:

server / # emerge --sync

Install vstfpd:

server / # emerge -v vsftpd

Copy the example configuration file as your template:

server / # cp /etc/vsftpd/vsftpd.conf.example /etc/vsftpd/vsftpd.conf


Edit the configuration file with these additional switches:

server / # vi /etc/vsftpd/vsftpd.conf 


file_open_mode=0666

local_umask=0022

virtual_use_local_privs=YES

anonymous_enable=NO

local_enable=YES

write_enable=YES

idle_session_timeout=600

ascii_upload_enable=NO

ascii_download_enable=NO

tcp_wrappers=YES

data_connection_timeout=120

userlist_enable=YES

userlist_deny=NO


Enter user names who will be permitted to access the site:

server / # vi /etc/vsftpd/user_list 

Populate this file with the same values:

server / # vi /etc/vsftpd/vsftpd.ftpusers 

Start vsftpd at boot:

server / # rc-update vsftpd add default 

Start vsftpd:

server / # /etc/init.d/vsftpd start 


  • check for the presence of home directories, which vsftp uses as default.
  • no login is allowed to a user who does not have a home directory stipulated.



Set Up User(s) For Web directory FTP Access

Edit the home directory path of the user:

server / # vi /etc/passwd 

UserName:x:1001:1002::/var/www/www.web.iat.sfu.ca/:/bin/bash


Add a group to allow access to web directory:

server / # groupadd ftpaccess 

Add user name to web directory group

server / # usermod -a -G ftpaccess UserName 

Set appropriate rights to the web directory:

server / # chmod -R 775 www.web.iat.sfu.ca/ 

Recursively change the group of the web directory:

server / # chgrp -R ftpaccess www.web.iat.sfu.ca/ 

Stop and start Apache:

server / # /etc/init.d/apache stop start 

Stop and start vsftpd:

server / # /etc/init.d/vsftpd stop start 


Troubleshooting Commands

This command will display your vsftpd configuation:

server / # grep -vE "^#" /etc/vsftpd/*