Ubuntu – How to remote host be mounted with nautilus from command line to avoid opening a nautilus window

11.10command linemountnautilus

A remote host can mount with nautilus:

nautilus sftp://<target-host>

But, in this case a nautilus window is opened. I would like to use this command in a script.

How can I avoid window opening?

Remark: I know sshfs, but I would like to use nautilus because I would like to see the connection in sidebar of nautilus and sshfs can cause problem if the remote host is down.

Best Answer

You can use the command:

gvfs-mount sftp://user@targethost

to mount a remote location by SFTP on the console. It also shows up in Nautilus (you can unmount it there) but it doesn't open a window automatically.

You have to enter the password for the remote host interactively when you use this command. (I don't know how to supply it by the command line or if gvfs-mount does make use of SSH keys. Would be nice if somebody could add this...)

Related Question