Fixing problem with sshfs asking to add host to the "known hosts" file
This commit is contained in:
parent
372ea8839b
commit
0410729136
3 changed files with 11 additions and 8 deletions
|
@ -18,7 +18,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#include <QDir>
|
||||
#include <QTimerEvent>
|
||||
|
||||
|
@ -102,7 +101,7 @@ void Mounter::onPakcageReceived(const NetworkPackage& np)
|
|||
connect(m_proc.data(), SIGNAL(started()), SLOT(onStarted()));
|
||||
connect(m_proc.data(), SIGNAL(error(QProcess::ProcessError)), SLOT(onError(QProcess::ProcessError)));
|
||||
connect(m_proc.data(), SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(onFinished(int,QProcess::ExitStatus)));
|
||||
|
||||
|
||||
const QString mpoint = m_sftp->mountPoint();
|
||||
QDir().mkpath(mpoint);
|
||||
|
||||
|
@ -116,12 +115,16 @@ void Mounter::onPakcageReceived(const NetworkPackage& np)
|
|||
<< "-p" << np.get<QString>("port")
|
||||
<< "-d"
|
||||
<< "-f"
|
||||
<< "-o IdentityFile=" + m_sftp->device()->privateKeyPath()
|
||||
<< "-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" << "IdentityFile=" + m_sftp->device()->privateKeyPath()
|
||||
<< "-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
|
||||
|
||||
m_proc->setProgram(program, arguments);
|
||||
|
||||
//To debug
|
||||
//m_proc->setStandardOutputFile("/tmp/kdeconnect-sftp.out");
|
||||
//m_proc->setStandardErrorFile("/tmp/kdeconnect-sftp.err");
|
||||
|
||||
cleanMountPoint();
|
||||
|
||||
kDebug(kdeconnect_kded()) << "Staring process: " << m_proc->program().join(" ");
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "sftpplugin.h"
|
||||
|
||||
#include <QDBusConnection>
|
||||
#include <QDir>
|
||||
|
||||
#include <KConfig>
|
||||
#include <KConfigGroup>
|
||||
|
@ -29,8 +30,8 @@
|
|||
#include <KNotification>
|
||||
#include <KRun>
|
||||
#include <KStandardDirs>
|
||||
#include <KFilePlacesModel>
|
||||
#include <kde_file.h>
|
||||
#include <kfileplacesmodel.h>
|
||||
|
||||
#include "sftp_config.h"
|
||||
#include "mounter.h"
|
||||
|
@ -156,7 +157,7 @@ QString SftpPlugin::mountPoint()
|
|||
{
|
||||
const QString defaultMountDir = KStandardDirs::locateLocal("appdata", "", true, componentData());
|
||||
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()
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
#include <KSharedConfig>
|
||||
#include <KConfigGroup>
|
||||
|
||||
#include <QFile>
|
||||
#include <qprocess.h>
|
||||
#include <QDir>
|
||||
#include <QDesktopServices>
|
||||
|
|
Loading…
Reference in a new issue