Difference between revisions of "Ftp"

From unRAID
Jump to: navigation, search
 
Line 8: Line 8:
  
 
So far as I can tell, vsftp comes with this version of unRaid and doesn't require any installtion - it's just there.
 
So far as I can tell, vsftp comes with this version of unRaid and doesn't require any installtion - it's just there.
 +
 +
By adding a ''#'' pound symbol to be beginning of a line, it effectively tells unRaid (linux) to ignore that line. It's called commenting out a line.
  
 
Start by editing the vsftpd.conf file
 
Start by editing the vsftpd.conf file
Line 13: Line 15:
 
'''''mcedit /etc/vsftpd.conf'''''
 
'''''mcedit /etc/vsftpd.conf'''''
  
change:<br />
+
Here's what the whole thing should look like:
''# No anonymous logins<br />
 
anonymous_enable=NO
 
  
to:<br />
 
''# No anonymous logins<br />
 
''# anonymous_enable=NO
 
  
add the following right after it:<br />
+
''#'' vsftpd.conf for unRAID<br />
''# Allow anonymous FTP?<br />
+
''#''<br />
 +
write_enable=YES<br />
 +
connect_from_port_20=YES<br />
 +
passwd_chroot_enable=YES<br />
 +
''#''<br />
 +
''#''<br />
 +
''#'' Allow anonymous FTP?<br />
 
anonymous_enable=YES<br />
 
anonymous_enable=YES<br />
anon_max_rate=0<br />
+
anon_max_rate=102400<br />
 
anon_mkdir_write_enable=NO<br />
 
anon_mkdir_write_enable=NO<br />
anon_root=/disk01/ftp/<br />
+
no_anon_password=YES<br />
anon_world_readable_only=YES<br />
+
''#''<br />
anon_umask=0022<br />
+
''#'' Allow local users to log in.<br />
anon_upload_enable=NO<br />
+
local_enable=YES<br />
anon_other_write_enable=NO<br />
+
local_umask=077<br />
no_anon_password=NO<br />
+
local_root=/mnt<br />
 +
check_shell=NO<br />
 +
''#'' anon_world_readable_only=NO<br />
 +
''#''<br />
 +
''#'' All file ownership will be 'root'<br />
 +
''#'' guest_enable=YES<br />
 +
''#'' guest_username=root<br />
 +
''#'' anon_upload_enable=YES<br />
 +
''#'' anon_other_write_enable=YES<br />
 +
''#'' anon_mkdir_write_enable=YES<br />
 +
''#''<br />
 +
''#'' Logging to syslog<br />
 +
syslog_enable=YES<br />
 +
log_ftp_protocol=NO<br />
 +
xferlog_enable=NO<br />
 +
''#''<br />
 +
''#'' Misc.<br />
 +
dirmessage_enable=NO<br />
 +
ls_recurse_enable=YES<br />
 +
 
 +
 
 +
 
 +
For an explanation of all these items, look the "vsftpd.conf manual" link at the bottom of the page
 +
 
 +
For an anonymous user, once they login, they're treated as a user named "ftp". You need to chose where you want their home directory to be. That is, where their directory tree starts once they login. You do that by modifying the /etc/passwd file.
 +
 
 +
There's a line in there that looks like this:<br />
 +
ftp:x:14:50::/home/ftp:/bin/false
 +
 
 +
I changed the line to look like this:<br />
 +
ftp:x:14:50::/mnt/user/Books/nautical_pubs:/bin/false
 +
 
 +
So the home directory for the anonymous ftp user ("ftp" on the system) is going to be /mnt/user/Books/nautical_pubs. Once they log in, it will look like they're in their home directory.
 +
 
 +
All the regular linux permissions apply, so you may have to do some messing around with them like this:
 +
'''chmod -R 775 /mnt/user/Books/nautical_pubs'''
 +
which would recursively make owner read/write/execute, group read/write/execute, and others (the ftp user) read/execute
 +
 
  
Where '/disk01/ftp/' is the root folder of all anonymous users
 
  
 +
give other people access to the stuff you want to share you need to make it readable and executable by others.<br />
 +
'''chmod o+rx -R /mnt/Books/nautical_pubs/'''
  
  
Line 42: Line 83:
 
*http://linux.die.net/man/5/vsftpd.conf more vsftpd.conf info
 
*http://linux.die.net/man/5/vsftpd.conf more vsftpd.conf info
 
*https://calomel.org/vsftpd.html a vsftpd howto
 
*https://calomel.org/vsftpd.html a vsftpd howto
 +
*http://www.linuxquestions.org/questions/linux-security-4/vsftpd-anonymous-user-419112/ getting ls to work while anon_root is set
 +
*http://www.g-loaded.eu/2008/12/02/set-up-an-anonymous-ftp-server-with-vsftpd-in-less-than-a-minute/ bind mounting to give anonymous access to other directories

Latest revision as of 06:00, 2 March 2012

The goal of this tutorial is to get you setup with the default unRaid ftp server with

  1. username/password to read/write from a specific directory
  2. anonymous username to read from that directory

I'm currently on Unraid Media server 5.0-b14. I will be using the root account in telnet to the server which is called DUMBO. I will put commands that I use in bold & italic on their own line.

Through some reading, users have said that unRaid comes with ProFTP. But for some reason, my system has vsFtp which is a different FTP server.

So far as I can tell, vsftp comes with this version of unRaid and doesn't require any installtion - it's just there.

By adding a # pound symbol to be beginning of a line, it effectively tells unRaid (linux) to ignore that line. It's called commenting out a line.

Start by editing the vsftpd.conf file

mcedit /etc/vsftpd.conf

Here's what the whole thing should look like:


# vsftpd.conf for unRAID
#
write_enable=YES
connect_from_port_20=YES
passwd_chroot_enable=YES
#
#
# Allow anonymous FTP?
anonymous_enable=YES
anon_max_rate=102400
anon_mkdir_write_enable=NO
no_anon_password=YES
#
# Allow local users to log in.
local_enable=YES
local_umask=077
local_root=/mnt
check_shell=NO
# anon_world_readable_only=NO
#
# All file ownership will be 'root'
# guest_enable=YES
# guest_username=root
# anon_upload_enable=YES
# anon_other_write_enable=YES
# anon_mkdir_write_enable=YES
#
# Logging to syslog
syslog_enable=YES
log_ftp_protocol=NO
xferlog_enable=NO
#
# Misc.
dirmessage_enable=NO
ls_recurse_enable=YES


For an explanation of all these items, look the "vsftpd.conf manual" link at the bottom of the page

For an anonymous user, once they login, they're treated as a user named "ftp". You need to chose where you want their home directory to be. That is, where their directory tree starts once they login. You do that by modifying the /etc/passwd file.

There's a line in there that looks like this:
ftp:x:14:50::/home/ftp:/bin/false

I changed the line to look like this:
ftp:x:14:50::/mnt/user/Books/nautical_pubs:/bin/false

So the home directory for the anonymous ftp user ("ftp" on the system) is going to be /mnt/user/Books/nautical_pubs. Once they log in, it will look like they're in their home directory.

All the regular linux permissions apply, so you may have to do some messing around with them like this: chmod -R 775 /mnt/user/Books/nautical_pubs which would recursively make owner read/write/execute, group read/write/execute, and others (the ftp user) read/execute


give other people access to the stuff you want to share you need to make it readable and executable by others.
chmod o+rx -R /mnt/Books/nautical_pubs/


Here are the links that I'm going from: