Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'my anonymous ftp setup in detail' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
my anonymous ftp setup in detail
Authored by: sekalreed on Apr 25, '01 02:04:48AM
here is my current ftp setup. i believe everything is in working order. if anything is out of whack or not working for you, let me know, and i'll see what i can do.
CAUTION: Please work on backups of your files! i'm not responsible for anything you do to your system.
anything in italics is a comment on this page, and should not be put into any files.
replace any instance of user with your username.

these are files which we'll deal with in the /etc directory
/etc/
-rw-r--r-- 1 root wheel 779 Apr 25 00:59 crontab
-rw-r--r-- 1 root wheel 86 Apr 24 20:59 ftpchroot
-rw-r--r-- 1 root wheel 100 Feb 25 03:05 ftpusers
-rw-r--r-- 1 root wheel 28 Apr 23 17:28 ftpwelcome
-rw-r--r-- 1 root wheel 40 Apr 24 21:02 motd

add this line to the end of the crontab file, which will run a script to change the permissions of all files in the upload directory every 60 minutes
/etc/crontab
*/60 * * * * root sh /Users/ftp/bin/upload_permissions

this file contains usernames who while be chroot() to their home directory
/etc/ftpchroot
# list of users chrooted for ftp access.
# read by ftpd(8).
ftp
anonymous

this file contains usernames who while be denied ftp access to prevent security breaches
/etc/ftpusers
# list of users disallowed any ftp access.
# read by ftpd(8).
Administrator
administrator
root
uucp

this file is displayed to all users when the connection is first established (command 220)
/etc/ftpwelcome
Welcome to ftp://ftp.david-s.net.

this file contains the message displayed when a user logs in (especially telnet or ssh)
/etc/motd
Welcome to Darwin 1.3.1 under Mac OS X!

this is the home directory for ftp users
~ftp/
dr-xr-xr-x 3 user ftp 264 Apr 23 02:09 System
dr-x--x--x 3 user ftp 264 Apr 23 02:10 bin
drwx-wx-wt 4 user ftp 92 Apr 25 00:21 dropbox
dr-x--x--x 3 user ftp 264 Apr 23 03:13 etc
drwxr-xr-t 3 user ftp 264 Apr 25 00:16 pub
dr-xr-xr-x 3 user ftp 264 Apr 23 02:07 usr

~ftp/System/
dr-xr-xr-x 3 user ftp 264 Apr 23 02:09 Library

~ftp/System/Library/
dr-xr-xr-x 3 user ftp 264 Apr 23 02:09 Frameworks

~ftp/System/Library/Frameworks/
dr-xr-xr-x 3 user ftp 264 Apr 23 02:09 System.framework

~ftp/System/Library/Frameworks/System.framework/
dr-xr-xr-x 3 user ftp 264 Apr 23 02:09 Versions

~ftp/System/Library/Frameworks/System.framework/Versions/
dr-xr-xr-x 3 user ftp 264 Apr 23 02:11 B

~ftp/System/Library/Frameworks/System.framework/Versions/B/
-r-xr-xr-x 1 root ftp 1260740 Apr 23 02:11 System

ls is copied from /bin/ls and upload_permissions must be created
~ftp/bin/
-r-xr-xr-x 1 user ftp 26984 Apr 23 02:10 ls
-r-x------ 1 user ftp 97 Apr 25 00:57 upload_permissions

this is a shell script to change the uploaded files' owner, group, and permissions (you can change them to whatever you wish). this script is run from the root crontab. if it is run from anything other than root, it will fail due to lack of permission.
~ftp/bin/upload_permissions
#!/bin/sh
chown user:staff /Users/ftp/dropbox/*
chmod 744 /Users/ftp/dropbox/*

this is your drop box, people can upload, but cannot view these files
~ftp/dropbox/
0

~ftp/etc/
-rw-r--r-- 1 user ftp 28 Apr 23 03:13 motd

this file is displayed to anonymous users upon login (command 230)
~ftp/etc/motd
Welcome to ftp://ftp.david-s.net.
Please feel free to upload in the dropbox directory, and download from the pub directory.

this is your public directory. you can put any files you wish others to download here
~ftp/pub/
0

~ftp/usr/
dr-xr-xr-x 4 user ftp 264 Apr 23 02:25 lib

these are copied from /usr/lib/dyld and /usr/lib/libSystem.B.dylib respectively
~ftp/usr/lib/
-r-xr-xr-x 1 user ftp 327528 Apr 23 02:10 dyld
-r-xr-xr-x 1 user ftp 1260740 Apr 23 02:25 libSystem.B.dylib


for more info, check out the man files for the following commands:
man ftpd
man -a chroot
man sticky


-david schlosnagle
http://www.david-s.net/


[ Reply to This | # ]
my anonymous ftp setup in detail
Authored by: by on Feb 03, '02 02:14:29PM

I did all this and it seems to run great...

There are two minor issues where I would like to ask for help:
One, upload permissions fails with an error if the directory is empty ("chown: /Users/ftp/incoming/*: No such file or directory", "chmod: /Users/ftp/incoming/*: No such file or directory").
Two, I would like to hide the contents of ~ftp/bin, ~ftp/etc, ~ftp/usr, and ~ftp/System to ftp-users; how could I do this?

Thanks and best regards,
Michael



[ Reply to This | # ]
my anonymous ftp setup in detail
Authored by: raffi on May 01, '04 04:15:51AM

HI
i did try few things to set up anonymous tfp

but there ie something which don't work when i put the file "ftpchroot"
into etc/ with the name you wrote : anonymous and ftp
login by ftp, deny acces to the computer if i let the file ftpchroot in etc/
then i take it of, but you can let the login and pass empty it works !
what need i to do for give acces to ftp user only ?





[ Reply to This | # ]