Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have everyone restricted to their home folder via FTP. Within each home I have a public_html directory which I'm not able to upload to.

I have added my user source to the ftp group. the public_html folder is...

drwxrwsr-x 2 source ftp 4096 public_html

I'm not sure why I'm not able to upload files. What am I doing wrong with permissions?

update

The VSFTPD logs read:

- TIMESTAMP - [pid 2] CONNECT: Client "xx.xxx.xx.xx"
- TIMESTAMP - [pid 1] [user] OK LOGIN: Client "xx.xxx.xx.xx"

update

SmartFTP returns the error:

[18:36:52] SIZE index.php
[18:36:52] 550 Could not get file size.

update

Smart FTP Logs

[23:15:31] TYPE I
[23:15:31] 200 Switching to Binary mode.
[23:15:31] SIZE index.php
[23:15:31] 550 Could not get file size.
[23:16:02] SIZE index.php
[23:16:02] 550 Could not get file size.
[23:16:32] SIZE index.php
[23:16:32] 550 Could not get file size.
[23:17:02] SIZE index.php
[23:17:02] 550 Could not get file size.
[23:17:32] SIZE index.php
[23:17:32] 550 Could not get file size.
[23:18:02] SIZE index.php
[23:18:02] 550 Could not get file size.
[23:18:12] DELE index.php
[23:18:12] 550 Permission denied.
[23:18:12] DELE test.php
[23:18:12] 550 Permission denied.
[23:18:19] TYPE A
[23:18:20] 200 Switching to ASCII mode

The FTP logs simply show login success messages, which user and which IP they're from.

Permissions of public_html

drwxr-sr-x 2 source ftp 4096 2010-08-15 18:40 public_html

even when public_html is 777 I'm unable to write to it.

share|improve this question
    
is this a webhosting server or personal server ? how is your ftp configured and which ftpserver are u using –  Prix Aug 14 '10 at 3:58
    
Also what is the error that the ftp tells you when you try to upload something ? it could be due to the fact of the port 20 being blocked by the firewall ftp uses 20 and 21 for communication and send/receive data. –  Prix Aug 14 '10 at 6:21
    
what are your logs saying? Can you turn on more verbose logging? –  Matt Aug 14 '10 at 6:59
    
Is the file system size full? –  Alvin Sim Aug 17 '10 at 15:09
    
No, it's a fresh installation with no sites on it at 500GB hard drive. –  Webnet Aug 19 '10 at 3:13
add comment

5 Answers 5

up vote 3 down vote accepted
+50

Please check you have write_enable=YES in your vsftpd.conf

You can su(do) to the user and try making the file by hand, that should rule out filesystem permission errors.

Could you post the full log from smartftp and perhaps your vsftpd.conf?

share|improve this answer
    
That was definitely something that I missed. But I'm still unable to upload an index.php to that directory –  Webnet Aug 19 '10 at 3:19
    
On the serverside: Could you try uploading another filename? Can you try to become that user (su/sudo) and create a file (touch indexmanual.php) in that directory? On the clientside: It looks like your smartftp log misses the interesting bit (STOR), not sure if that is actually happening. Could you try filezilla or some other ftp client? –  Joris Aug 19 '10 at 7:48
add comment

I suspect that your homedirs are not globally executable or readable, hence it's not the publc_html directory that's the problem, but rather one of its parent directories. What are their perms?

share|improve this answer
add comment

Is this a redhat based system with selinux enforced? Type:
getenforce and let us know what it says, if it's enforcing you need to specifically allow FTP users to access their home directories:
setsebool -P ftp_home_dir=1

Also, can you access the home directories as the user? It sounds stupid but the permissions might be wrong. SSH in as root and try:
su - username
It should automatically go into their home directory, then cd into public_html and verify with
pwd and cd into the directory if not. If you can't permissions issues.
Next, try to write a file:
echo "test" >> test.txt if it doesn't work, again permissions issues.

share|improve this answer
    
It's an ubuntu-server –  Webnet Aug 19 '10 at 3:22
add comment

I know you say you've tried 777 permissions, but neither of your two ls examples above show 777 (rwxrwxrwx). Of course this shouldn't be needed, but it might be useful to rule out this possibility.

Another thing is, you might need to add the STOR command to the cmds_allowed directive if you have one and that command is not already there.

A reasonably comprehensive list is probably something like

cmds_allowed=ABOR,CWD,LIST,MDTM,MKD,NLST, PASS,PASV,PORT,PWD,QUIT,RETR,RMD,RNFR, RNTO,SITE,SIZE,STOR,TYPE,USER,ACCT, APPE,CDUP,HELP,MODE,NOOP,REIN,STAT,STOU,STRU,SYST

share|improve this answer
    
is cmds_allowed something that should be managed via VSFTPD configuration? –  Webnet Aug 19 '10 at 19:56
    
I don't see that option preconfigured at all in vsftpd.conf but I also added those commands. sudo /etc/init.d/vsftpd restart doesn't seem to be restarting VSFTPD –  Webnet Aug 19 '10 at 22:37
add comment
chown -R username:groupname /path/to/public_html/
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.