LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Is there any way to do this? (https://www.linuxquestions.org/questions/linux-software-2/is-there-any-way-to-do-this-132550/)

Renaxgade 01-07-2004 06:49 PM

Is there any way to do this?
 
Is there any possible way to limit the contents of a folder to jpeg and gif extensions only? I am hosting an ftp folder for some kids, don't want them doing anything stupid or uploading scripts. I am using ProFTP, so is there a way to make sure or restrict to anything but gif's, or jpeg's being uploaded? TIA.

Tinkster 01-07-2004 07:44 PM

And if you could they'd rename it :}

megagame_hack.exe.gif


;)



Cheers,
Tink

Renaxgade 01-07-2004 07:46 PM

So are you saying you cannot? If they upload exe.gif, it would work as a gif and not an executable right?

nrunge 01-07-2004 08:17 PM

He is saying that that it doesnt matter if you could. File extensions dont really mean anything, they are just for personal organization. I could upload "xxxpron.mpeg.gif" and if I play the file "xxxpron.mpeg.gif" with xine or mpplayer the video would play regardless of the file extension. Or on your server they could upload "superftphax0r.exe.gif" and run it as an executable.

Tinkster 01-07-2004 08:45 PM

Quote:

Originally posted by Renaxgade
So are you saying you cannot? If they upload exe.gif, it would work as a gif and not an executable right?
What I was saying is that you can't assume it's
what it says it is. That is, to be MORE safe (there's
always a way around if you're evil, or curious,or
bored) the ftp-daemon would have to run e.g. file against a
file once it's uploaded to determine what it REALLY
is, and delete it if it's something that you don't want.

I don't think that something like
PathAllowFilter
(Config statement for Proftpd) will do anything
but checking the file-name which isn't good enough
if the kids aren't completely dumb trolls.

I'm not quite sure what your concern is, though.
Do you not want the kids to "trade" certain things,
or are you afraid they might compromise your machine?



Cheers,
Tink

stickman 01-07-2004 08:55 PM

You could set up a cron job that would run the file command against every uploaded file in the directory. A good start to pick out non-gif and non-jpg files would be:
file * | grep -v "GIF image" | grep -v "JPEG image" | cut -d: -f1

Of course, this is a very simple test and it's not foolproof but its a start.


All times are GMT -5. The time now is 04:56 PM.