FTP shared access , no anonymous

Discussion in 'Tips/Tricks/Mods' started by tonysch, Jan 6, 2008.

  1. tonysch

    tonysch New Member

    Is there a way to setup multiple (or all) users having access to the same FTP directory using their login credentials, and no anonymous access?

    Thank you in advance...
    tonysch
     
  2. falko

    falko Super Moderator Howtoforge Staff

    No, that's not possible.
     
  3. tonysch

    tonysch New Member

    Is there a way to setup a "shortcut" from users ftp directory to another users ftp directory?

    TIA Tony
     
  4. public_domain

    public_domain New Member

    just curious. WHY WOULD YOU WANT TO DO THAT?
     
  5. falko

    falko Super Moderator Howtoforge Staff

    No, normal users don't have the permissions to do that. Only the admin can browse all user directories of a web site.
     
  6. vmlinuz

    vmlinuz New Member

    Oh,yes,you can.
    Logic.
    Something to think about:

    If you have VSFTP,

    FTP Users with Read-Only Access to a Shared Directory

    In this example, anonymous FTP is not desired, but a group of trusted users need to have read-only access to a directory for downloading files. Here are the steps:
    Disable anonymous FTP. Comment out the anonymous_enable line in the vsftpd.conf file:
    # Allow anonymous FTP?
    # anonymous_enable=YES
    Enable individual logins by making sure you have the local_enable line uncommented in the vsftpd.conf file:
    # Uncomment this to allow local users to log in.
    local_enable=YES
    Start VSFTP.
    [root@bigboy tmp]# service vsftpd start
    Create a user group and shared directory. In this case, use /home/ftp-users and a user group name of ftp-users for the remote users:
    [root@bigboy tmp]# groupadd ftp-users
    [root@bigboy tmp]# mkdir /home/ftp-docs
    Make the directory accessible to the ftp-users group:
    [root@bigboy tmp]# chmod 750 /home/ftp-docs
    [root@bigboy tmp]# chown root:ftp-users /home/ftp-docs
    Add users, and make their default directory /home/ftp-docs:
    [root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user1
    [root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user2
    [root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user3
    [root@bigboy tmp]# useradd -g ftp-users -d /home/ftp-docs user4
    [root@bigboy tmp]# passwd user1
    [root@bigboy tmp]# passwd user2
    [root@bigboy tmp]# passwd user3
    [root@bigboy tmp]# passwd user4
    Copy files to be downloaded by your users into the /home/ftp-docs directory.
    Change the permissions of the files in the /home/ftp-docs directory to read-only access by the group:
    [root@bigboy tmp]# chown root:ftp-users /home/ftp-docs/*
    [root@bigboy tmp]# chmod 740 /home/ftp-docs/*
    Users should now be able to log in via FTP to the server using their new usernames and passwords. If you absolutely don’t want any FTP users to be able to write to any directory, then you should set the write_enable line in your vsftpd.conf file to no:
    write_enable = NO
    Remember, you must restart VSFTPD for the configuration file changes to take effect.

    Sample Login Session to Test Functionality

    Here is a simple test procedure you can use to make sure everything is working correctly:
    Check for the presence of a test file on the FTP client server.
    [root@smallfry tmp]# ll
    total 1
    -rw-r--r-- 1 root root 0 Jan 4 09:08 testfile
    [root@smallfry tmp]#
    Connect to Bigboy via FTP:
    [root@smallfry tmp]# ftp 192.168.1.100
    Connected to 192.168.1.100 (192.168.1.100)
    220 ready, dude (vsFTPd 1.1.0: beat me, break me)
    Name (192.168.1.100:root): user1
    331 Please specify the password.
    Password:
    230 Login successful. Have fun.
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp>
    As expected, you can’t do an upload transfer of testfile to bigboy:
    ftp> put testfile
    local: testfile remote: testfile
    227 Entering Passive Mode (192,168,1,100,181,210) 553 Could not create file.
    ftp>
    But we can view and download a copy of the VSFTPD RPM on the FTP server bigboy:
    ftp> ls
    227 Entering Passive Mode (192,168,1,100,35,173)
    150 Here comes the directory listing.
    -rwxr----- 1 0 502 76288 Jan 04 17:06 vsftpd-1.1.0-1.i386.rpm
    226 Directory send OK.
    ftp> get vsftpd-1.1.0-1.i386.rpm vsftpd-1.1.0-1.i386.rpm.tmp
    local: vsftpd-1.1.0-1.i386.rpm.tmp remote: vsftpd-1.1.0-1.i386.rpm
    227 Entering Passive Mode (192,168,1,100,44,156)
    150 Opening BINARY mode data connection for vsftpd-1.1.0-1.i386.rpm (76288 bytes).
    226 File send OK.
    76288 bytes received in 0.499 secs (1.5e+02 Kbytes/sec)
    ftp> exit
    221 Goodbye.
    [root@smallfry tmp]#
    As expected, an anonymous FTP fails:
    [root@smallfry tmp]# ftp 192.168.1.100
    Connected to 192.168.1.100 (192.168.1.100)
    220 ready, dude (vsFTPd 1.1.0: beat me, break me)
    Name (192.168.1.100:root): anonymous
    331 Please specify the password.
    Password:
    530 Login incorrect.
    Login failed.
    ftp> quit
    221 Goodbye.
    [root@smallfry tmp]#
    Now that testing is complete, you can make this a regular part of your FTP server’s operation.
     

Share This Page