Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
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
?
590 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
  • 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
Who's Defending Your Organization from Threats?

Protecting against advanced threats requires an IT dream team – a well-oiled machine of people and solutions working together to defend your organization. Download our resource kit today to learn more about the tools you need to build you IT Dream Team!

 
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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 …
Fine Tune your automatic Updates for Ubuntu / Debian
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

564 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