Read-only FTP dirs?


#1

OK I have searched everywhere on an easy way to do this; and can’t seem to do it via shell:

I want an ftp user account to have access to upload to, say, an “Incoming” directory; but only have read-only to all the rest.

Furthermore, my “main” user account should have full access to move stuff out of the “incoming” directory, into one of the other folders that’s read-only for that user.

Normally I would do some chmodding, but, my “main” user account does not appear to have access to my other user’s account. Perhaps this is because all accounts are treated equally?


#2

Read the wiki page on Unix Groups.

  1. I think you’ll do better by setting all these directories up in a subarea your main users home directory. Let’s call this subdirectory “shared_ftp”.
  2. Set up a group for the two users. Let’s call this group “shared_ftp_group”
  3. Change the group for the shared_ftp folder to the new group. Make this folder readable and executable for the group.
  4. When you set up all the subdirectories, you have to change the group for each of them to “shared_ftp_group”. You also have to make each folder readable and executable for the group.
  5. Create the “incoming” directory for the “other” user to be in the right group and rwx for the group.

To make things easier for the other user, you can create a symbolic link to the “shared_ftp” directory from their home directory.

Free unique IP and $67 off with promo code [color=#CC0000]FLENSFREEIP67[/color] or use [color=#CC0000]FLENS97[/color] for $97 off. Click here for more options


#3

I will try that, thank you.


#4

Hi!

Thanks for posting this solution!

I tried to implement this, but there might be a problem with using symblinks from ftp.

I try to use ftp from the commandline on osx 10.4.10 and here is what I see:

150 Opening ASCII mode data connection for file list
drwx–S— 5 otheruser defaultgroup 4096 Aug 2 12:53 Maildir
lrwxrwxrwx 1 otheruser defaultgroup 36 Aug 5 10:32 shared-ftp -> /home/.tico/myuser/mydomain.com/shared-ftp

and when I try to cd this this dir I get

ftp> cd shared-ftp
550 shared-ftp: No such file or directory

TIA for any ideas on how to solve this issue.

-Kaj :slight_smile:


#5

You’re right! If you’re using plain FTP, I don’t think you can access files outside of the ftp root for that user, which is the user’s home directory.

This works using SFTP and also works to be able to access the files for either scripts or for web access.

Free unique IP and $67 off with promo code [color=#CC0000]FLENSFREEIP67[/color] or use [color=#CC0000]FLENS97[/color] for $97 off. Click here for more options


#6

Ok, thanks for answering!

-Kaj :slight_smile: