Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    2

    Default New Account whitout FTP access

    Hi. I want to create new accounts but whitout FTP access. This can be done trought the hooks? How can I do this task?

    Many thanks
    Last edited by cheru; 06-05-2009 at 09:05 AM.

  2. #2
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by cheru View Post
    Hi. I want to create new accounts but whitout FTP access. This can be done trought the hooks? How can I do this task?

    Many thanks
    Creating cPanel user accounts that do not have FTP access is not natively supported by cPanel/WHM at this time. Nor am I aware of any API/hook functionality that would let you implement such limitations.

    If you do not want any users to have FTP access, try disabling the FTP server. If you want the user to have no access to the files on their account, be sure to disable File Manager, Legacy File Manager and turn off cpdavd (Web Disk server) as well.

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    2

    Default

    I 've disabled File Manager, Legacy File Manager, turned off cpdavd and changed the user package (I leave checked only the mail features). But when I create a new user the FTP access is still allowed...
    I modify the hook /scripts/postwwwacctuser and I added this line to solve the problem:

    echo $1 >> /etc/ftpusers

    And it's all. The final solution.

    Thanks for your help

  4. #4
    Member
    Join Date
    Apr 2006
    Posts
    25

    Default Disable users FTP

    If your using Pure-FTP it's very simple to disable a users account.
    Cpanel should add it as a feature if you ask me.

    if you look at /usr/sbin/pureauth

    you see this in the code

    Code:
    # Create ftpusers array
    if ( -e '/etc/ftpusers' && !-z '/etc/ftpusers' ) {
        open my $ftpusers_fh, '<', '/etc/ftpusers';
        my @ftpusers = <$ftpusers_fh>;
        close $ftpusers_fh;
        @ftpusers = grep { s/[\r\n\s]//g } @ftpusers;
    
        # disallow accounts in ftpusers
        if ( any( sub { lc($acctowner) eq lc($_) }, @ftpusers ) ) {
            failed_auth();
        }
    }
    i just make a file
    /etc/ftpusers

    add the accounts username in the file
    Then they can no longer FTP into their account.

    Other account can still FTP in fine. So i would say it works

  5. #5
    Registered User
    Join Date
    Feb 2010
    Posts
    1

    Default

    To disallow specific users instead of disallowing all users of an account

    Edit (/usr/sbin/pureauth)

    Search for

    Code:
    # Create ftpusers array
    if ( -e '/etc/ftpusers' && !-z '/etc/ftpusers' ) {
        open my $ftpusers_fh, '<', '/etc/ftpusers';
        my @ftpusers = <$ftpusers_fh>;
        close $ftpusers_fh;
        @ftpusers = grep { s/[\r\n\s]//g } @ftpusers;
    
        # disallow accounts in ftpusers
        if ( any( sub { lc($acctowner) eq lc($_) }, @ftpusers ) ) {
            failed_auth();
        }
    }

    Add this CODE before or after


    Code:
    # Create ftpusers2 array
    if ( -e '/etc/ftpusers2' && !-z '/etc/ftpusers2' ) {
        open my $ftpusers_fh, '<', '/etc/ftpusers2';
        my @ftpusers2 = <$ftpusers_fh>;
        close $ftpusers_fh;
        @ftpusers2 = grep { s/[\r\n\s]//g } @ftpusers2;
    
        # disallow users in ftpusers2
        if ( any( sub { lc($user) eq lc($_) }, @ftpusers2 ) ) {
            failed_auth();
        }
    }
    Or you can just change the $acctowner to $user in the original code.

    Save

    create file (/etc/ftpusers2) and add the disallowed usernames

    The main user (username) or (sub_user@domain.com)

    I use this to disallow FTP for the main user and force him to use SFTP

    However, the file (/usr/sbin/pureauth) might be replaced by future updates.

    Thank you for your help
    Last edited by mohamed81; 02-11-2010 at 05:59 AM.

  6. #6
    Member sehh's Avatar
    Join Date
    Feb 2006
    Location
    Europe
    Posts
    461

    Default

    Does the above work for sftp as well?
    CODE IS POETRY

  7. #7
    Technical Product Specialist cPanelDavidG's Avatar
    Join Date
    Nov 2006
    Location
    Houston, TX
    Posts
    11,189
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    Quote Originally Posted by sehh View Post
    Does the above work for sftp as well?
    All of the above is for FTP. SFTP (SSH File Transfer) works via SSH instead, so it is not influenced by FTP configurations. However, FTPS (FTP over SSL/TLS) does work via FTP and would be influenced by the above.

Similar Threads & Tags
Similar threads

  1. Can't access sub FTP account using explorer?
    By sh4ka in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 12-01-2007, 09:18 AM
  2. e-mail account has ftp access
    By kernow in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 11-20-2005, 06:23 AM
  3. How do I access a FTP account?
    By Aloosenation in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 12-19-2004, 08:54 PM
  4. Cant access FTP for 1 account only
    By AbeFroman in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 06-11-2003, 08:32 PM
  5. Disable FTP Access for a single account.
    By evolver in forum cPanel and WHM Discussions
    Replies: 3
    Last Post: 06-10-2003, 11:34 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube