ftpnetbeans-8vsftpd

NetBeans - Upload on save fails, but it works with filezilla


I created a fresh ftp user named john and changed the owner of my project recursively to john:ftp-users.

I tested the connection in NetBeans. I get connection successfull!.

However, If I try to upload changes, then I get this:

227 Entering Passive Mode (192,168,40,44,117,81).
STOR bla.sql.new
553 Could not create file.
DELE bla.sql.new
550 Delete operation failed.

So I tested the user on FileZilla. Result: everything works.

I also tested the user on the command line on the server:

ftp localhost
Trying ::1:21 ...
Connected to localhost.
220 Willkommen auf dem Entwicklungsserver
Name (localhost:root): john
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

As you can see the connection works.

Why can't I upload files on NetBeans?


The permission is set to 744 (directories) and 644 (files).


/etc/vsftpd.conf

write_enable=YES
dirmessage_enable=YES
nopriv_user=ftpsecure
ftpd_banner=Willkommen auf dem Entwicklungsserver
ls_recurse_enable=YES
local_enable=YES
anonymous_enable=NO
anon_world_readable_only=YES
syslog_enable=YES
connect_from_port_20=YES
ascii_upload_enable=YES
pam_service_name=vsftpd
listen=YES
#listen_ipv6=YES

ssl_enable=NO
rsa_cert_file=
dsa_cert_file=
#
# Limit passive ports to this range to assis firewalling
pasv_min_port=30000
pasv_max_port=30100

I tried this answer and this without success.


I looked up the error codes 553 and 550.

553 says it is not working because of the filename not being allowed. So I changed the filename to many different things and it still fails with the same error.

550 is permission denied.


Log File of FileZilla for successfully uploaded file:

2018-10-19 17:00:30 19616 3 Status: Connect to 192.168.40.44:21 ...
2018-10-19 17:00:30 19616 3 Status: Connection established, wait for welcome message ...
2018-10-19 17:00:30 19616 3 Answer: 220 Welcome to the development server
2018-10-19 17:00:30 19616 3 Command: AUTH TLS
2018-10-19 17:00:30 19616 3 Answer: 530 Please login with USER and PASS.
2018-10-19 17:00:30 19616 3 Command: AUTH SSL
2018-10-19 17:00:30 19616 3 Answer: 530 Please login with USER and PASS.
2018-10-19 17:00:30 19616 3 Status: Unsecure server; he does not support FTP over TLS.
2018-10-19 17:00:30 19616 3 Command: USER john
2018-10-19 17:00:30 19616 3 Answer: 331 Please specify the password.
2018-10-19 17:00:30 19616 3 Command: PASS *******************
2018-10-19 17:00:30 19616 3 Answer: 230 Login successful.
2018-10-19 17:00:30 19616 3 Command: OPTS UTF8 ON
2018-10-19 17:00:30 19616 3 Answer: 200 Always in UTF8 mode.
2018-10-19 17:00:30 19616 3 Status: Registered
2018-10-19 17:00:30 19616 3 Status: Start uploading from C: \ Users \ PC983 \ asdfasdf.txt
2018-10-19 17:00:30 19616 3 Command: CWD / srv / www / htdocs
2018-10-19 17:00:30 19616 3 Answer: 250 Directory successfully changed.
2018-10-19 17:00:30 19616 3 Command: TYPE A
2018-10-19 17:00:30 19616 3 Answer: 200 Switching to ASCII mode.
2018-10-19 17:00:30 19616 3 Command: PASV
2018-10-19 17:00:30 19616 3 Answer: 227 Entering Passive Mode (192,168,40,44,117,80).
2018-10-19 17:00:30 19616 3 Command: STOR asdfasdf.txt
2018-10-19 17:00:30 19616 3 Answer: 150 Ok to send data.
2018-10-19 17:00:30 19616 3 Answer: 226 Transfer complete.
2018-10-19 17:00:30 19616 3 Status: file transfer successful, transfer 5 bytes in 1 second
2018-10-19 17:00:30 19616 3 Status: Receive directory content for "/ srv / www / htdocs" ...
2018-10-19 17:00:30 19616 3 Command: TYPE I
2018-10-19 17:00:30 19616 3 Answer: 200 Switching to Binary mode.
2018-10-19 17:00:30 19616 3 Command: PASV
2018-10-19 17:00:30 19616 3 Answer: 227 Entering Passive Mode (192,168,40,44,117,86).
2018-10-19 17:00:30 19616 3 Command: LIST
2018-10-19 17:00:30 19616 3 Answer: 150 Here comes the directory listing.
2018-10-19 17:00:30 19616 3 Answer: 226 Directory send OK.
2018-10-19 17:00:30 19616 3 Status: Completed displaying the directory contents for "/ srv / www / htdocs"

Passive Mode is turned on.


Solution

  • I was able to solve it by changing the upload directory to the home directory of the ftp user.

    Setting the upload directory to /srv/www/htdocs solved it, even though the home directory of the ftpuser is already set to /srv/www/htdocs.

    If I logged in via FileZilla, then I always started at /srv/www/htdocs, but I was also able to navigate to the root.

    I don't know why I had to do this.