LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-27-2003, 06:00 PM   #1
breakerfall
Member
 
Registered: Jun 2003
Location: Manchester, UK
Distribution: Gentoo
Posts: 306

Rep: Reputation: 30
(Resolved)File uploaded via FTP have bad permissions


Hola

I'm using pureFTP with virtual users. The 2 users are chrooted to the apache htdocs directory and for some reason, when I upload a file to the webserver I can't view it. I see permissions denied so I then have to SSH into the box and do a chmod on the dir so I can access the files online.

This is a bit of a pain (even though the box in question is sat next to my desktop machine ) but I would like to resolve the issue.

The owner and group on the htdocs directory in apache is "ftp". This is set so that my ftp users can upload. Without this set, they can connect but not navigate or upload. Anyhow, once they have upload a file it cannot be viewed and as mentioned I have to SSH in a do a chmod on the dir to allow access the files.

I would really appreciate any suggestion that would help me resolve this....

Thanks

Last edited by breakerfall; 12-28-2003 at 04:29 PM.
 
Old 12-27-2003, 07:24 PM   #2
bcarl314
Member
 
Registered: Jun 2003
Location: USA, Minnesota - Land of 10,000 lakes
Distribution: Red Hat 9, Mandrake 10
Posts: 56

Rep: Reputation: 15
What are the permission settings on the htdocs directory? Also what's your umask set to?
 
Old 12-27-2003, 08:53 PM   #3
breakerfall
Member
 
Registered: Jun 2003
Location: Manchester, UK
Distribution: Gentoo
Posts: 306

Original Poster
Rep: Reputation: 30
I haven't set a umask (I don't believe) unless you mean: chmodded the dir to 755 several times.

Thanks
 
Old 12-27-2003, 09:09 PM   #4
bcarl314
Member
 
Registered: Jun 2003
Location: USA, Minnesota - Land of 10,000 lakes
Distribution: Red Hat 9, Mandrake 10
Posts: 56

Rep: Reputation: 15
Actually, your system should have a umask set by default, usually something like 022

If you run the command "umask" you'll see what your system is set to. Basically, this changes the default permissions when a file a created by subtracting that value from 755 for directories and 644 for files. So if you have a umask of 044, when files are created, they are created with 600 for permissions.

What are the permission settings on the files when they are uploaded? (octet version)

Another thought, have you considered adding the users to the ftp group? That should allow them to connect and upload as themselves, not as the ftp user.
 
Old 12-27-2003, 10:11 PM   #5
breakerfall
Member
 
Registered: Jun 2003
Location: Manchester, UK
Distribution: Gentoo
Posts: 306

Original Poster
Rep: Reputation: 30
Thanks for the reply

Quote:
Another thought, have you considered adding the users to the ftp group? That should allow them to connect and upload as themselves, not as the ftp user.
I wanted to use virtual users for this FTP rather than adding the users to my system user list.

The umask of my system is 022 as you said it would be.

It doesn't seem to matter what the permissions are on files before they're sent. Even when they have been chmodded to 755.

For example, I send an image to the server:

before sending
Code:
-rwxr-xr-x    1 breakerfall users       86169 Dec 24 03:45 wow.jpg
after sending
Code:
-rw-------    1 ftp      ftp         86169 Dec 28 04:07 wow.jpg
The real strange thing is that I wasn't having problems the other day. This wasn't an issue and both myself and my friend could FTP into the server and upload files and access them online just fine. I just freshly installed the system on that machine so I have been making changes constantly the past few days which could have caused the problem.

I don't know if it could be related but the only thing I can think of is the fact that I re-compiled PHP for apache and mysql just yesterday.

Quote:
What are the permission settings on the files when they are uploaded? (octet version)
I do not know the values yet. Is there a way of finding out and are you referring to the numerical value of the w, r, x etc? I haven't dabbled with file permissions up to know: there's a lot to learn and not enough hours in each day

Again, thanks for the reply
 
Old 12-28-2003, 12:51 PM   #6
bcarl314
Member
 
Registered: Jun 2003
Location: USA, Minnesota - Land of 10,000 lakes
Distribution: Red Hat 9, Mandrake 10
Posts: 56

Rep: Reputation: 15
Now that I think about it, the umask can be set for individual users as well (I think). Try logging into your system as the user ftp and see what the umask is. It seems to be behaving like it's set to 044.

The only other thing I can think of is you've got something configured in your ftp application that's setting those permissions.
 
Old 12-28-2003, 03:47 PM   #7
breakerfall
Member
 
Registered: Jun 2003
Location: Manchester, UK
Distribution: Gentoo
Posts: 306

Original Poster
Rep: Reputation: 30
The umask showed up as 022 when logging in via ssh using the ftp user. I have even tried removing the FTP user from the system and re-creating it, recreating the virtual users... all to no avail

I'm really not sure what I can do.... I have tried re-creating the virtual users to work from a different user and group other than ftp. The problem is definately server side because the same thing happens to my friend when he uploads to the server.

Any more ideas at all? Thanks
 
Old 12-28-2003, 04:29 PM   #8
breakerfall
Member
 
Registered: Jun 2003
Location: Manchester, UK
Distribution: Gentoo
Posts: 306

Original Poster
Rep: Reputation: 30
Sorry for wasting your time, I can be a dunce sometimes :|

I just went through my pure ftp config file and saw an incorrect entry. Something I should have done when I first noticed the problem. Thanks for all your help
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Vsftpd uploaded files Permissions silver05 Linux - Software 2 09-30-2005 08:22 AM
wsftpd and uploaded file permissions Crashputer Linux - Software 1 08-01-2005 05:10 AM
ftp changes file permissions! seran Linux - General 2 07-13-2005 07:34 AM
Uploaded Files permissions (proftpd) Wynand1 Linux - Security 1 01-28-2005 03:32 AM
locking a usage policy file/ftp file permissions gbow Linux - Newbie 0 02-16-2004 05:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration