I am on Debian Jessie without desktop environment. I try to mount an FTP by command line using gvfs-mount.

I gathered information on the web and I understood that gvfs comunicates with dbus.

So my first step was to install dbus and gvfs required packages :

apt-get install dbus-x11 gvfs-bin gvfs-fuse

Then I reboot, because dbus installed its own service.

After that, I am logging in as www-data

sudo -Hu www-data -s /bin/bash

(-s /bin/bash is because this user has no bash)

From here, I have to launch a dbus-daemon for my user and export the resulting DBUS_SESSION_BUS_ADDRESS in order for gvfs to communicate with that daemon. So I do:

dbus-launch --sh-syntax > "$HOME/.dbus_settings"

.dbus_settings contains something like:

cat .dbus_settings 

My environment variable DBUS_SESSION_BUS_ADDRESS is not set at this time, so I run:

export DBUS_SESSION_BUS_ADDRESS='unix:abstract=/tmp/dbus-XwbyV2BmA5,guid=6c111d728c263543b61e6293570e1f22'

In order to handle future gvfs mounts, I created a .gvfs folder in my user $HOME (for www-data it is /var/www)

Now, I think (but I am not sure) I have all set to use gvfs. so I launch gvfsd-fuse like this:

/usr/lib/gvfs/gvfsd-fuse $HOME/.gvfs -o big_writes

That seems to work. The folder $HOME/.gvfs appears to be mounted (but there is nothing in it yet).

The last command is the effective FTP mount:

gvfs-mount ftp://myftpuser@myftpserver < file_containing_ftp_password

But, I always get this error:

Error mounting location: Location is not mountable

These steps work on my Linux Mint 17.3 amd64 desktop. But I cannot make it work on a Debian Jessie server (without desktop and x11).

Any help is appreciated.

2 Answers 2


I found the problem. A package was missing gvfs-backends and some commands was useless.

To resume, the steps are :

  1. Install necessary packages:

    apt-get install dbus-x11 gvfs-bin gvfs-fuse gvfs-backends

  2. Create .gvfs folder if it does not exist

    mkdir $HOME/.gvfs

  3. Start a dbus session and store DBUS_SESSION_BUS_ADDRESS to be able to re-use it

    dbus-launch --sh-syntax > "$HOME/.dbus_settings"

  4. export DBUS_SESSION_BUS_ADDRESS using source for example

    source "$HOME/.dbus_settings"

  5. Simply mount it with gvfs-mount

    gvfs-mount ftp://myftpuser@myftpserver

Shell will prompt for your password. You can also create a file containing your password and give it to gvfs-mount so that the command will be:

gvfs-mount ftp://myftpuser@myftpserver < file_containing_my_ftp_password
  1. Access your mounted FTP at this place:

    cd $HOME/.gvfs/ftp:host\=myftpserver\,user\=myftpuser/

Done !


It would be better to use dbus-run-session some-script.sh, then you can call gio mount or other gio tool inside some-script.sh.

dbus-run-session will kill dbus-daemon after script execution, or you need to manual kill dbus-daemon if you use dbus-launch .

It would be little troublesome to use dbus-run-session because you need to write another script and call it with command dbus-run-session.

You can do like:


sed '1,/^exit$/d' $0 | dbus-run-session sh

ftp_url=ftp://[email protected]/
echo $ftp_password | gio mount $ftp_url

    gio info $ftp_url | awk '$1 == "id::filesystem:" { print $2 }'

cp --archive --verbose --update \
   "$ftp_gio_path"/ \

gio mount -u $ftp_url

or use tail:

tail +4 $0 | dbus-run-session sh

# script here

or use heredoc:

dbus-run-session sh <<DBUS_SESSION

# script here
# but you need to escape $ and \

echo \$foo
touch white\\ space


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .