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
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.
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.
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
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
i just make a fileCode:# 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(); } }
/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![]()
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
Or you can just change the $acctowner to $user in the original code.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(); } }
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.
Does the above work for sftp as well?
CODE IS POETRY