Fixing problem with sshfs asking to add host to the "known hosts" file

This commit is contained in:
Albert Vaca 2014-02-14 17:12:15 +01:00
parent 372ea8839b
commit 0410729136
3 changed files with 11 additions and 8 deletions

View file

@ -18,7 +18,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <QDir> #include <QDir>
#include <QTimerEvent> #include <QTimerEvent>
@ -116,12 +115,16 @@ void Mounter::onPakcageReceived(const NetworkPackage& np)
<< "-p" << np.get<QString>("port") << "-p" << np.get<QString>("port")
<< "-d" << "-d"
<< "-f" << "-f"
<< "-o IdentityFile=" + m_sftp->device()->privateKeyPath() << "-o" << "IdentityFile=" + m_sftp->device()->privateKeyPath()
<< "-o StrictHostKeyChecking=no" //Do not ask for confirmation because it is not a known host << "-o" << "StrictHostKeyChecking=no" //Do not ask for confirmation because it is not a known host
<< "-o UserKnownHostsFile=/dev/null"; //Prevent storing as a known host << "-o" << "UserKnownHostsFile=/dev/null"; //Prevent storing as a known host
m_proc->setProgram(program, arguments); m_proc->setProgram(program, arguments);
//To debug
//m_proc->setStandardOutputFile("/tmp/kdeconnect-sftp.out");
//m_proc->setStandardErrorFile("/tmp/kdeconnect-sftp.err");
cleanMountPoint(); cleanMountPoint();
kDebug(kdeconnect_kded()) << "Staring process: " << m_proc->program().join(" "); kDebug(kdeconnect_kded()) << "Staring process: " << m_proc->program().join(" ");

View file

@ -21,6 +21,7 @@
#include "sftpplugin.h" #include "sftpplugin.h"
#include <QDBusConnection> #include <QDBusConnection>
#include <QDir>
#include <KConfig> #include <KConfig>
#include <KConfigGroup> #include <KConfigGroup>
@ -29,8 +30,8 @@
#include <KNotification> #include <KNotification>
#include <KRun> #include <KRun>
#include <KStandardDirs> #include <KStandardDirs>
#include <KFilePlacesModel>
#include <kde_file.h> #include <kde_file.h>
#include <kfileplacesmodel.h>
#include "sftp_config.h" #include "sftp_config.h"
#include "mounter.h" #include "mounter.h"
@ -156,7 +157,7 @@ QString SftpPlugin::mountPoint()
{ {
const QString defaultMountDir = KStandardDirs::locateLocal("appdata", "", true, componentData()); const QString defaultMountDir = KStandardDirs::locateLocal("appdata", "", true, componentData());
const QString mountDir = KConfig("kdeconnect/plugins/sftp").group("main").readEntry("mountpoint", defaultMountDir); const QString mountDir = KConfig("kdeconnect/plugins/sftp").group("main").readEntry("mountpoint", defaultMountDir);
return mountDir + "/" + device()->id() + "/"; return QDir(mountDir).absoluteFilePath(device()->id());
} }
void SftpPlugin::onMounted() void SftpPlugin::onMounted()

View file

@ -27,7 +27,6 @@
#include <KSharedConfig> #include <KSharedConfig>
#include <KConfigGroup> #include <KConfigGroup>
#include <QFile>
#include <qprocess.h> #include <qprocess.h>
#include <QDir> #include <QDir>
#include <QDesktopServices> #include <QDesktopServices>