?
Solved

Is it possible to limit file size and restrict file types for a certain FTP account?

Posted on 2003-03-21
19
Medium Priority
?
589 Views
Last Modified: 2010-04-22
I would like to give one of our users FTP access to our server. Restricting him to just a certain directory is no problem, but I would also like to restrict the file size he may upload, the overall size of files in the directory as well as the type of files. Is that possible?

P.S. I'm on a virtual hosting account with CPanel installed. I do have shell access, but since it's only a virtual account, I might not have all the necessary access rights. Thanks anyway!
0
Comment
Question by:yosmc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 5
  • 5
19 Comments
 
LVL 11

Expert Comment

by:kblack05
ID: 8182603
Sure....man ulimit.

You can limit file size allowed in this manner in
/etc/services

Regards,

~K Black
0
 

Author Comment

by:yosmc
ID: 8183144
Not sure if that'll work for me. I have a /etc folder on my account, but not an /etc/services - so if I created one I'm not sure if it would be effective.

Any way, what kind of file should I create, and put what inside?
0
 
LVL 11

Expert Comment

by:kblack05
ID: 8183447
If you want to pass parameters which limit file sizes
to the shell of the users you will need to set up the
/home/userid/.bashrc and .ftprc

Something like

ulimit -f filesize

should do it.

~K Black
0
Quick Cloud Training

Looking for some quick training on the cloud in 2 hours or less? Check out these how-to guides in AWS, Linux, OpenStack, Azure, and more!

 
LVL 11

Expert Comment

by:kblack05
ID: 8183470
Just google.com for ".bashrc" "ulimit -f" here's one of the
examples:

http://www.cs.uic.edu/~consult/how/startup_files/bashrc

Ftp can be similarly maintained.

Regards,

~K Black
0
 

Author Comment

by:yosmc
ID: 8183603
Thanks a lot for the advice, however - as I said - I only have a virtual account (=no server control), so I'm afraid I can't set up what you are describing here...
0
 
LVL 11

Expert Comment

by:kblack05
ID: 8183616
Sure you can. You can edit the .rc files in the users
home directory surely!!

~KB
0
 

Author Comment

by:yosmc
ID: 8184377
Ok, I created a file called .ftprc and put the line "ulimit -f 1" in it. I placed it in my root at /home/userid - but I can still upload all sizes of files.

Hope I don't seem incredibly stupid - obviously I'm doing something very wrong?
0
 
LVL 11

Expert Comment

by:kblack05
ID: 8184402
try

limit -f 1024

~KB

limit = ftp

ulimit = bash
0
 

Author Comment

by:yosmc
ID: 8184511
Ok, I created a file called .ftprc and put the line "ulimit -f 1" in it. I placed it in my root at /home/userid - but I can still upload all sizes of files.

Hope I don't seem incredibly stupid - obviously I'm doing something very wrong?
0
 

Author Comment

by:yosmc
ID: 8184542
(Sorry about the message above - it got re-posted when I pressed "refresh"...)

Tried it with "limit" instead of "ulimit" - unfortunately still no sign of success... :(
0
 
LVL 6

Expert Comment

by:mbarbos
ID: 8194519
What ftp server are you using (proftp, pure-ftp etc.) ?
0
 

Author Comment

by:yosmc
ID: 8194616
How can I tell?
0
 
LVL 6

Expert Comment

by:mbarbos
ID: 8194641
Well, you can see the processes that are running, you can ask support, or maybe you get a banner when you connect
0
 

Author Comment

by:yosmc
ID: 8194673
Thanks! :) It's PureFTPd 1.0.12.
0
 
LVL 6

Expert Comment

by:mbarbos
ID: 8194919
The PureFTPd site is a http://www.pureftpd.org (big surprise :). With pureftpd it's possible to limit the number of files and the total size with virtual-quota (see http://www.pureftpd.org/README). I doubt that you can easily limit the size od one file (unless you allow just one file, in which case the total size would be the size of the file:) or the files by their type (no matter how you want to determine the file type)
0
 
LVL 6

Expert Comment

by:mbarbos
ID: 8234782
Any news ?
0
 

Author Comment

by:yosmc
ID: 8278967
Big SORRY for taking so long to respond - a very busy time at my day-time job (I'm only a leisure-time webmaster) was followed by hardware problems on my home PC.

I looked at the info provided on the pureftpd site, but from my understanding it's something you can only do when you have the access/rights to configure & compile your server. With a virtual account, it seems like it's just not possible, because all I can do is set up new FTP accounts via CPanel, but this doesn't mean that I also have the rights to do the fine-tuning.
It seems like with this approach, I would need to have the rights to change files below my document root, which unfortunately I do not have.
0
 
LVL 6

Accepted Solution

by:
mbarbos earned 800 total points
ID: 8279059
I'm afraid that you don't have many options left. Maybe the best thing to do would be to contact support and see if they don't provide a ftp daemon with quota/db support already compiled.

I doubt that you have many options left, except, maybe, quota support for the filesystem. But this would create other problems.
0
 

Author Comment

by:yosmc
ID: 8279224
Thanks mbardos. As my question was if it's possible, "no" is an acceptable answer as well, so I'm giving you the points. Equal thanks to kblack, if it was possible to split the points, I would do it, but unfortunately it's not possible either. :)
0

Featured Post

Four New Appliances. Same Industry-leading Speeds.

But don't take it from us.  The Firebox M370 is Miercom tested and Miercom approved, outperforming its competitors for stateless and stateful traffic throughput scenarios.  Learn more about the M370, M470, M570 and M670 and find the right solution for your organization today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

​Being a Managed Services Provider (MSP) has presented you  with challenges in the past— and by meeting those challenges you’ve reaped the rewards of success.  In 2014, challenges and rewards remain; but as the Internet and business environment evol…
Hello EE, Today we will learn how to send all your network traffic through Tor which is useful to get around censorship and being tracked all together to a certain degree. This article assumes you will be using Linux, have a minimal knowledge of …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month11 days, 20 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question