proftpd blocking out user?

Discussion in 'Server Operation' started by bswinnerton, Oct 22, 2008.

  1. bswinnerton

    bswinnerton New Member

    Hi everyone,

    I've been trying to narrow down my FTP problem, and finally came close today. But could use someone's help. I created a user (webuser) using adduser and added him to a group called webusers. I then carried out the following:
    Code:
    chgrp webusers /var/www/
    so that this one user could have access to all of the folders in my /var/www/ directory. But for some reason when I try to FTP in (Only with this user), it will either time out or simply not list the directory contents. I SSH'd into my server as webuser and even tried to make sure that I could ls the /var/www/ directory and was able to create a new file and then delete it so it is not a permissions problem. So the only thing that I could think of was that perhaps proftpd was blocking that one user? Is that possible?

    Here is my proftpd.conf file:

    Code:
    #
    # /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file.
    # To really apply changes reload proftpd after modifications.
    # 
    
    # Includes DSO modules
    Include /etc/proftpd/modules.conf
    
    # Set off to disable IPv6 support which is annoying on IPv4 only boxes.
    UseIPv6				off
    
    ServerName			"Debian"
    ServerType			standalone
    DeferWelcome			off
    
    MultilineRFC2228		on
    DefaultServer			on
    ShowSymlinks			on
    
    TimeoutNoTransfer		600
    TimeoutStalled			600
    TimeoutIdle			1200
    
    DisplayLogin                    welcome.msg
    DisplayChdir                    .message
    ListOptions                	"-l"
    
    DenyFilter			\*.*/
    
    # Use this to jail all users in their homes 
    DefaultRoot			~
    
    # Users require a valid shell listed in /etc/shells to login.
    # Use this directive to release that constrain.
    # RequireValidShell		off
    
    # Port 21 is the standard FTP port.
    Port				21
    
    # In some cases you have to specify passive ports range to by-pass
    # firewall limitations. Ephemeral ports can be used for that, but
    # feel free to use a more narrow range.
    # PassivePorts                  49152 65534
    
    # If your host was NATted, this option is useful in order to
    # allow passive tranfers to work. You have to use your public
    # address and opening the passive ports used on your firewall as well.
    # MasqueradeAddress		1.2.3.4
    
    # To prevent DoS attacks, set the maximum number of child processes
    # to 30.  If you need to allow more than 30 concurrent connections
    # at once, simply increase this value.  Note that this ONLY works
    # in standalone mode, in inetd mode you should use an inetd server
    # that allows you to limit maximum number of processes per service
    # (such as xinetd)
    MaxInstances			30
    
    # Set the user and group that the server normally runs at.
    User				proftpd
    Group				nogroup
    
    # Umask 022 is a good standard umask to prevent new files and dirs
    # (second parm) from being group and world writable.
    Umask				022  022
    # Normally, we want files to be overwriteable.
    AllowOverwrite			on
    
    # Uncomment this if you are using NIS or LDAP to retrieve passwords:
    # PersistentPasswd		off
    
    # Be warned: use of this directive impacts CPU average load!
    # Uncomment this if you like to see progress and transfer rate with ftpwho
    # in downloads. That is not needed for uploads rates.
    #
    # UseSendFile			off
    
    # Choose a SQL backend among MySQL or PostgreSQL.
    # Both modules are loaded in default configuration, so you have to specify the backend 
    # or comment out the unused module in /etc/proftpd/modules.conf.
    # Use 'mysql' or 'postgres' as possible values.
    #
    #<IfModule mod_sql.c>
    # SQLBackend			mysql
    #</IfModule>
    
    TransferLog /var/log/proftpd/xferlog
    SystemLog   /var/log/proftpd/proftpd.log
    
    <IfModule mod_tls.c>
    TLSEngine off
    </IfModule>
    
    <IfModule mod_quota.c>
    QuotaEngine on
    </IfModule>
    
    <IfModule mod_ratio.c>
    Ratios on
    </IfModule>
    
    
    # Delay engine reduces impact of the so-called Timing Attack described in
    # http://security.lss.hr/index.php?page=details&ID=LSS-2004-10-02
    # It is on by default. 
    <IfModule mod_delay.c>
    DelayEngine on
    </IfModule>
    
    <IfModule mod_ctrls.c>
    ControlsEngine        on
    ControlsMaxClients    2
    ControlsLog           /var/log/proftpd/controls.log
    ControlsInterval      5
    ControlsSocket        /var/run/proftpd/proftpd.sock
    </IfModule>
    
    <IfModule mod_ctrls_admin.c>
    AdminControlsEngine on
    </IfModule>
    
    # A basic anonymous configuration, no upload directories.
    
    # <Anonymous ~ftp>
    #   User				ftp
    #   Group				nogroup
    #   # We want clients to be able to login with "anonymous" as well as "ftp"
    #   UserAlias			anonymous ftp
    #   # Cosmetic changes, all files belongs to ftp user
    #   DirFakeUser	on ftp
    #   DirFakeGroup on ftp
    # 
    #   RequireValidShell		off
    # 
    #   # Limit the maximum number of anonymous logins
    #   MaxClients			10
    # 
    #   # We want 'welcome.msg' displayed at login, and '.message' displayed
    #   # in each newly chdired directory.
    #   DisplayLogin			welcome.msg
    #   DisplayFirstChdir		.message
    # 
    #   # Limit WRITE everywhere in the anonymous chroot
    #   <Directory *>
    #     <Limit WRITE>
    #       DenyAll
    #     </Limit>
    #   </Directory>
    # 
    #   # Uncomment this if you're brave.
    #   # <Directory incoming>
    #   #   # Umask 022 is a good standard umask to prevent new files and dirs
    #   #   # (second parm) from being group and world writable.
    #   #   Umask				022  022
    #   #            <Limit READ WRITE>
    #   #            DenyAll
    #   #            </Limit>
    #   #            <Limit STOR>
    #   #            AllowAll
    #   #            </Limit>
    #   # </Directory>
    # 
    # </Anonymous>
    
    IdentLookups off
    ServerIdent on "FTP Server ready."
    
    
    DefaultRoot ~
    
    Include /etc/proftpd_ispconfig.conf
    
    UseReverseDNS off
    
    If anyone else has any other ideas to solve this please let me know!!
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Are there any errors in your logs? Did you try active and passive mode?
    What's webuser's home directory?
     
  3. bswinnerton

    bswinnerton New Member

    No there are no errors in the proftpd log, only ones saying that the user successfully logged in and that its chrooting to /var/www/

    The home folder is /var/www/ so that one user can browse all of my web folders for ease of access. I've had this working in the past, and don't know why it stopped working now.

    I have tried both active and passive, but none the less I can log in on any different user fine with active and passive.
     
  4. falko

    falko Super Moderator Howtoforge Staff

    What's the output of
    Code:
    grep webuser /etc/passwd
    , and what's in /etc/shells?
     
  5. bswinnerton

    bswinnerton New Member

    /etc/passwd:

    Code:
    webuser:x:1002:1002:,,,:/var/www/:/bin/bash
    and /etc/shells:

    Code:
    # /etc/shells: valid login shells
    /bin/csh
    /bin/sh
    /usr/bin/es
    /usr/bin/ksh
    /bin/ksh
    /usr/bin/rc
    /usr/bin/tcsh
    /bin/tcsh
    /usr/bin/esh
    /bin/dash
    /bin/bash
    /bin/rbash
    /bin/false
    /SENDMAIL/ANY/SHELL/
     
  6. falko

    falko Super Moderator Howtoforge Staff

    That's ok. What's the output of
    Code:
    ls -la /var/www
    ?
     
  7. bswinnerton

    bswinnerton New Member

    Data removed for privacy
     
    Last edited: Oct 26, 2008
  8. bswinnerton

    bswinnerton New Member

    Here is just a quick addition to help you troubleshoot:

    I have an VERY weird problem. I can login with this user when I am inside the local network. But when I get out I cannot FTP in with this user (But still can with other users).

    I am completely baffled.
     
  9. falko

    falko Super Moderator Howtoforge Staff

    Did you also try active and passive mode from outside your LAN? I guess it could be your router's firewall.
     
  10. bswinnerton

    bswinnerton New Member

    Yes, I have tried both active and passive outside my LAN. But how would that explain letting me login as anyone else?
     
  11. falko

    falko Super Moderator Howtoforge Staff

    Can you move the server into the DMZ (you can configure the DMZ on your router) and try again? If it works then, your router's firewall is most likely the problem.
     
  12. bswinnerton

    bswinnerton New Member

    All right, put the server on the DMZ and all the ports are open, but I still can't seem to FTP in with that one particular user. =(
     
  13. bswinnerton

    bswinnerton New Member

    I'm not sure if this would have anything to do with it, but when I restart proftpd, it says:

    Code:
    /etc/init.d/proftpd restart
     * Stopping ftp server proftpd
       ...done.
     * Starting ftp server proftpd
     - setting default address to 127.0.0.1
       ...done.
    Should that be my external IP?
     
  14. bswinnerton

    bswinnerton New Member

    Finally making some progress. If I FTP in with specifing the direct path it works (but only with some folders). The only thing that I can think of is a permissions issue ?=(
     
    Last edited: Oct 28, 2008
  15. falko

    falko Super Moderator Howtoforge Staff

    Did you compare the parmissions (and ownerships) of the working with the not working directories?
     
  16. bswinnerton

    bswinnerton New Member

    I tried with ls -l but couldn't seem to make any sense out of it. What would be the best way to compare them?
     
  17. falko

    falko Super Moderator Howtoforge Staff

    If you see something like this:

    Code:
    root@server1:~# ls -l
    total 4
    drwxr-xr-x 10 root root 4096 2008-09-22 14:31 ispconfig
    root@server1:~#
    then the "d" means it's a directory, the next three letters are for the owner ("rwx" means read, write, and execute permissions), the following three letters ("r-x" = read and execute permissions) are for the group, and the last three letters ("r-x") are for everyone else.

    "root root" means that the owner is root, and the group is "root" as well.
     
  18. bswinnerton

    bswinnerton New Member

    Falko, I PM'd you my permissions if you'd care to look at them.
     
  19. falko

    falko Super Moderator Howtoforge Staff

    You sent me the permissions of just one directory. I need the permissions of one working and one not-working directory.
     
  20. bswinnerton

    bswinnerton New Member

    My apologies, I just sent you a non working directory as well.
     

Share This Page