Closed herrbischoff closed 9 years ago
Hi @herrbischoff,
Thank you for the bug report. Does your user have permission to create directories on the given FTP server? That error response looks to be coming back from the FTP server as a "permission denied", but it's not a failed authentication attempt, it's a failed authorization attempt (in creating a directory).
Thanks @sethvargo. Yes, just confirmed that again. When logging in via command-line or via Transmit, I can manipulate files and folders on the server just fine.
Interestingly, the error message changed from yesterday when I ran vagrant push
again. The only thing I changed is the Ruby version, I updated that just to be sure:
$ ruby -v
ruby 2.0.0p598 (2014-11-13 revision 48408) [x86_64-darwin14.1.0]
Here's the new error message:
/opt/vagrant/embedded/lib/ruby/2.0.0/net/ftp.rb:326:in `getresp': 550 Can't create directory: File exists (Net::FTPPermError)
from /opt/vagrant/embedded/lib/ruby/2.0.0/net/ftp.rb:351:in `block in sendcmd'
from /opt/vagrant/embedded/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
from /opt/vagrant/embedded/lib/ruby/2.0.0/net/ftp.rb:349:in `sendcmd'
from /opt/vagrant/embedded/lib/ruby/2.0.0/net/ftp.rb:844:in `mkdir'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/pushes/ftp/adapter.rb:74:in `upload'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/pushes/ftp/push.rb:22:in `block (2 levels) in push'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/pushes/ftp/push.rb:21:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/pushes/ftp/push.rb:21:in `block in push'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/pushes/ftp/adapter.rb:63:in `connect'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/pushes/ftp/push.rb:33:in `connect'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/pushes/ftp/push.rb:20:in `push'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.1/lib/vagrant/environment.rb:567:in `push'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.1/plugins/commands/push/command.rb:23:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.1/lib/vagrant/cli.rb:42:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.1/lib/vagrant/environment.rb:301:in `cli'
from /opt/vagrant/bin/../embedded/gems/gems/vagrant-1.7.1/bin/vagrant:174:in `<main>'
Now it's "Can't create directory: File exists". When checking the FTP server after running the command, I do see a created folder with my Vagrantfile in it but nothing else.
@herrbischoff as you can see from the stack trace, we are using Ruby's built-in Net FTP library to communicate with the FTP server. Are you sure this is FTP and not SFTP?
I apologize in advance, but these issues are incredibly difficult to debug because I do not have access to your FTP server. The 550 error code specifically refers to "Requested action not taken. File unavailable (e.g., file not found, no access).", so this still seems like an authorization issue to me. Perhaps Transmit is performing the operation differently?
Your Ruby version should have nothing to do with Vagrant if you've installed Vagrant using the official installers. Vagrant comes pre-packaged with its own Ruby environment.
@sethvargo I have just created a completely clean FTP account from scratch. Same issues there. If you're on the IRC channel, I could send you a login to this throwaway account so you could check it out yourself. If you'd be willing to and if it helped that is. And yes, it's plain FTP on port 21. Also, I used the official Vagrant installer.
@herrbischoff I wrote the FTP plugin, but I'm not an expert in FTP permissions so I do not think that will help :frowning:. Even if I can reproduce the issue, I followed the Ruby FTP docs to a "t", so I do not know why it is not working.
@herrbischoff FYI: here is the Ruby code that uploads the file to the server, and that is straight from the Ruby docs.
@sethvargo Thanks. I'm really new to Ruby so I don't get all of it. I believe parent = File.dirname(remote)
contains the value I set via push.destination
, correct? If so, the code possibly tries to create the parent folder although it already exists. I'm just guessing here, sorry.
Also, I'm asking myself about why the default FTP port is set to 20:
def default_port
20
end
I know FTP uses port 20 for data transfers but port 21 for the connection attempt. This could explain why setting my FTP hostname without ":21" attached results in a refused connection.
Just in case you're interested, here's a transcript of a simple FTP session with that very server via shell:
$ ftp [redacted]@[redacted]
Connected to [redacted].
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 23:14. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
331 User [redacted] OK. Password required
Password:
230 OK. Current restricted directory is /
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd web
250 OK. Current directory is /web
ftp> ls
227 Entering Passive Mode (148,251,66,209,192,35)
150 Accepted data connection
drwx--x--x 4 5031 client1 4096 Jan 2 22:50 .
drwxr-xr-x 9 0 0 4096 Jan 2 22:49 ..
-rwxr-xr-- 1 5031 client1 26 Jan 2 22:49 .htaccess
drwxr-xr-x 2 5031 client1 4096 Jan 2 22:49 error
-rwxr-xr-- 1 5031 client1 7358 Jan 2 22:49 favicon.ico
-rwxr-xr-- 1 5031 client1 1861 Jan 2 22:49 index.html
-rwxr-xr-- 1 5031 client1 14 Jan 2 22:49 robots.txt
drwxr-xr-x 2 0 0 4096 Jan 2 22:49 stats
226-Options: -a -l
226 8 matches total
ftp> mkdir vagrant
257 "vagrant" : The directory was successfully created
ftp> exit
221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
221 Logout.
There appears to be no permission problem on the FTP side.
I don't mean to spam you, @sethvargo. Just to let you know about my progress. I have verified vagrant push
is not working with a large web hosting provider (meaning a commercial provider and not a server set up by me) – same error. I have specified no push.destination
this time and also needed to attach ":21" to the hostname to get it to work.
So it looks like we need to fix the default port. Are you able to connect to it using Ruby's native FTP libraries?
@sethvargo: I have whipped up the tiny script below to test the functionality on the second (commercial) server.
require 'net/ftp'
Net::FTP.open('[redacted]') do |ftp|
ftp.login('[redacted]', '[redacted]')
ftp.mkdir('/web')
puts ftp.list()
end
It works as expected.
$ ruby ftp.rb
drwxr-xr-x 3 f019f83f w0097746 4096 Jan 4 01:57 .
drwxr-xr-x 3 f019f83f w0097746 4096 Jan 4 01:57 ..
drwxr-xr-x 2 f019f83f w0097746 4096 Jan 4 01:57 web
@herrbischoff hrm... this is really weird. I'll explore a bit more.
@herrbischoff what if you set passive
to false
?
@herrbischoff I believe I have fixed these issues in master and they will be in the next release.
Hey i am trying to push some file to locally running vagrant machine but getting the following errors
Uploading E:/vagrant_getting_started to @localhost:4000:/
C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/net/protocol.rb:153:in `read_nonblo
ck': end of file reached (EOFError)
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/net/protocol.rb:153:in
`rbuf_fill'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/net/protocol.rb:134:in
`readuntil'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/net/ftp.rb:1108:in `re
adline'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/net/ftp.rb:289:in `get
line'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/net/ftp.rb:300:in `get
multiline'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/net/ftp.rb:318:in `get
resp'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/net/ftp.rb:338:in `voi
dresp'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/net/ftp.rb:249:in `blo
ck in connect'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/monitor.rb:211:in `mon
_synchronize'
from C:/HashiCorp/Vagrant/embedded/lib/ruby/2.0.0/net/ftp.rb:247:in `con
nect'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/pushe
s/ftp/adapter.rb:61:in `connect'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/pushe
s/ftp/push.rb:44:in `connect'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/pushe
s/ftp/push.rb:30:in `push'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/e
nvironment.rb:567:in `push'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/comma
nds/push/command.rb:28:in `execute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/c
li.rb:42:in `execute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/e
nvironment.rb:301:in `cli'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.2/bin/vagrant:1
74:in `<main>'
My push strategy is as below
config.push.define "ftp" do |push|
push.host="localhost:4000"
push.destination = "/"
end
and also enable port forwarding as
config.vm.network "forwarded_port", guest: 80, host: 4000
Suggest something.
I believe I have fixed these issues in master and they will be in the next release.
@sethvargo I'm on 1.7.2 and vagrant push
dies once it hits the first subdirectory. The files in the root of the directory get transferred but the first directory it comes across doesn't get created on the remote host.
I'm using port 7322
but I doubt that matters and I've tried to set passive
to both true
and false
with no difference in result.
# vagrant --version
Vagrant 1.7.2
# grep -r push -A 1 ./Vagrantfile
./Vagrantfile: config.push.define "ftp" do |push|
./Vagrantfile: push.host = "[redacted]:7322"
./Vagrantfile: push.passive = false
./Vagrantfile: push.username = "[redacted]"
./Vagrantfile: push.password = "[redacted]"
./Vagrantfile: push.secure = true
./Vagrantfile: push.destination = "/home/jmathai/vagrant-test"
./Vagrantfile: push.dir = "widelens"
./Vagrantfile- end
# vagrant push
Uploading /Users/mathai_j/dev/orion-tbx to jmathai@[redacted]:7322:/home/jmathai/vagrant-test
/opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/operations/upload.rb:321:in `on_open': Net::SFTP::StatusException open /home/jmathai/vagrant-test/documentation/Readme.markdown (2, "no such file") (Net::SFTP::StatusException)
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/request.rb:87:in `call'
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/request.rb:87:in `respond_to'
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:948:in `dispatch_request'
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:911:in `when_channel_polled'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:311:in `call'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:311:in `process'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `block in preprocess'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `each'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `preprocess'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:802:in `loop'
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/operations/upload.rb:203:in `wait'
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:103:in `upload!'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/pushes/ftp/adapter.rb:114:in `upload'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/pushes/ftp/push.rb:33:in `block (2 levels) in push'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/pushes/ftp/push.rb:31:in `each'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/pushes/ftp/push.rb:31:in `block in push'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/pushes/ftp/adapter.rb:109:in `block in connect'
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:939:in `call'
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:939:in `block in do_version'
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:939:in `each'
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:939:in `do_version'
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:909:in `when_channel_polled'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:311:in `call'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/channel.rb:311:in `process'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `block in preprocess'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `each'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:222:in `preprocess'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:205:in `process'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `block in loop'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
from /opt/vagrant/embedded/gems/gems/net-ssh-2.9.1/lib/net/ssh/connection/session.rb:169:in `loop'
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:802:in `loop'
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/session.rb:787:in `connect!'
from /opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp.rb:32:in `start'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/pushes/ftp/adapter.rb:107:in `connect'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/pushes/ftp/push.rb:44:in `connect'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/pushes/ftp/push.rb:30:in `push'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:567:in `push'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/plugins/commands/push/command.rb:28:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/cli.rb:42:in `execute'
from /opt/vagrant/embedded/gems/gems/vagrant-1.7.2/lib/vagrant/environment.rb:301:in `cli'
from /opt/vagrant/bin/../embedded/gems/gems/vagrant-1.7.2/bin/vagrant:174:in `<main>'
Hi!, I'm in the exactly same situation as jmathai. Someone know a solution? Thanks
@carlosrovira: As things stand now, it appears your best bet is to not be using vagrant push
for FTP deployments. Something's awfully borked in the implementation. Also, a several months long silence from @sethvargo certainly doesn't help things moving forward.
What I find peculiar about @jmathai's logs is the repeated mention of Net::SFTP
and ssh
, when in fact Net::FTP
should have been utilized.
@herrbischoff thanks for your response. I'm new to vagrant and want to know if there's other way to deploy (if not via FTP). Could you pointme to other solutions?
Thanks in advance
Also getting this issue like @carlosrovira @jmathai using SFTP, as soon as the first directory is hit the error occurs
vv -v push vagrant-stag
/opt/vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/operations/upload.rb:321:in `on_open': Net::SFTP::StatusException open /home/vagrant/public_html/wp-admin/css/about-rtl.css (2, "no such file") (Net::SFTP::StatusException)
I can create/remove directories using the same credentials manually.
I left this product due to this issue. This problem makes this unusable. It's a shame since the overall intention is very cool and a tiny bugs like this invalidate it totally.
I haven't bothered to check again after the 1.7.2 version was still broken in this regard. I consider Vagrant's deployment function completely non-functional as is. However, I use other deployment strategies now, like Capistrano, Fabric, vinyl-ftp and Dandelion (which comes closest to vagrant push
for FTP, plus benefits). All of those work beautifully.
However, now that there's docker-compose, Vagrant has somewhat limited appeal and usage for me anyway.
Well it's still not working then as I am using 1.7.2, I do actually use Git to deploy but was interested in trying out the built in (S)FTP solution until I hit the directory issue.
Same problem here...
$ vagrant push
Uploading C:/Users/Mike/web/sites/test to root@32.220.45.5:49773:/
C:/HashiCorp/Vagrant/embedded/gems/gems/net-sftp-2.1.2/lib/net/sftp/operations/upload.rb:321:in `on_open': Net::SFTP::StatusException open C:/Vagrantfile (2, "no such file") (Net::SFTP::StatusException)
I just ran into this problem today, Vagrant 1.8.1. I have to manually create all the directories before "vagrant push" will work.
It's not problem of Vagrant, seems like issue with net::sftp, as it happens even without vagrant (ruby 2.2.5p241 (2016-02-24 revision 53909) [x86_64-darwin15]
). Upload, download works, but not mkdir/rmdir and it is not a permission issue.
Environment
Problem
I tried to set up the
vagrant push
command according to the documentation. Whenever I try to push with the FTP strategy, I get the following error:The FTP server specified is reachable, the login is correct and when manually logging in via command-line
ftp
, everything checks out. I can create and manipulate all data on the server, there are no obvious permission problems, contrary to what Ruby complains about.What could be the problem? Am I doing something terribly wrong?