Dreamweaver and SFTP

March 17th, 2008 · 19 Comments

I was writing some PHP for a customer of mine and encountered a very annoying problem with Dreamweaver CS3, two problems actually….

Authentication Failures

The first was solved pretty easily, it seems that Dreamweaver won’t play nice with an sshd that isn’t configured to have PasswordAuthentication yes. So if you’re getting a login/password error the first thing to do is to goto the web server open up sshd.conf and make sure that the “no” is a “yes”, and then restart the ssh daemon. It seems “no” is default on a lot of Linux systems.

If you don’t have access to your sshd.conf, try contacting your server admin, if they don’t help you might be stuck using an application like Cyberduck (Mac) or WinsCP (Windows) for uploading files to SFTP.

Note: I have heard this could cause a security issue as it may enable “clear text” passwords which means your password may not be encrypted as it’s sent to the server.  I can’t confirm this, so if anyone happens to know, please leave a comment. 

SFTP Not On Default Port 22

The second problem is even more annoying: You can’t change the SFTP/SSH port in Dreamweaver CS3!!! What the hell Adobe?? We’re locked in to using port 22 as our SFTP, even if the server we’re working with is using 10022 (as was the case for me today). Although I love Dreamweaver and wouldn’t dream of using another app to write PHP in, I can’t believe that for the cost of it compared to other (free) software you can’t even change the SFTP port.

Okay, enough complaining… there’s got to be a work-around right? Of course! This work-around is only for Mac users, however Windows users will be able to do the same thing with plink.exe (available at The PuTTY web site). Using plink.exe to forward ports is somewhat confusing, so be prepared to do some research.If you’re using a Mac it’s much easier, what we’ll be doing is mapping port 22 on our local machine (IP 127.0.0.1 or localhost) to the remote ip address and remote port using the ssh command.

First, open up your Terminal and find out if you have any ssh-agent processes running. You can find out by typing:

ps aux | grep ssh

 

Note, you should see your ps command in the process tree, and nothing else.

 

If you do happen to have ssh-agent process running it means that port 22 on your local computer is already in use, so you’ll have to kill the process. To do this, type:

killall -9 ssh-agent

This should stop any ssh-agent processes.

Now that you’re positive port 22 is available on your local machine, you can forward it to the real SFTP port on the remote machine using the ssh command – simply type:

sudo ssh -L 22:localhost:22 -p 10022 username@domain.com

 

 

In Dreamweaver you need to modify your FTP Host from the real SFTP address to say “localhost” or “127.0.0.1”.  This will point Dreamweaver’s SFTP client over to your local computer on the default port 22 which is set to map to the remote host on whichever port you have set up.  

  

 

You can upload and download files like normal, as long as your Terminal is still open and logged in via the ssh command above.

Tags: Dreamweaver · Mac · Work