#1 Le 25/01/2020, à 01:14
- RidingAround
[RESOLU] Duplicity et paramiko : droits
Bonsoir à tous,
je viens de monter un VPS chez un hébergeur.
J'ai installé duplicity
sudo apt install duplicity
et paramiko
sudo apt install python-pip
sudo pip install paramiko
J'ai fait un script qui engage duplicity à faire une sauvegarde et à l'envoyer sur un serveur distant.
Je l'ai placé dans /home/user2/
Je peux lancer le script avec
sudo ./monscript.sh
Mais si je le lance en tant que simple user2, j'obtiens :
sing archive dir: /home/user2/.cache/duplicity/1ec63264749cdf83763476f30c785f38
Using backup name: 1ec63264749cdf83763476f30c785f38
Import of duplicity.backends.acdclibackend Succeeded
Import of duplicity.backends.azurebackend Succeeded
Import of duplicity.backends.b2backend Succeeded
Import of duplicity.backends.botobackend Succeeded
Import of duplicity.backends.cfbackend Succeeded
Import of duplicity.backends.dpbxbackend Failed: No module named dropbox
Import of duplicity.backends.gdocsbackend Succeeded
Import of duplicity.backends.giobackend Succeeded
Import of duplicity.backends.hsibackend Succeeded
Import of duplicity.backends.hubicbackend Succeeded
Import of duplicity.backends.imapbackend Succeeded
Import of duplicity.backends.lftpbackend Succeeded
Import of duplicity.backends.localbackend Succeeded
Import of duplicity.backends.mediafirebackend Succeeded
Import of duplicity.backends.megabackend Succeeded
Import of duplicity.backends.multibackend Succeeded
Import of duplicity.backends.ncftpbackend Succeeded
Import of duplicity.backends.onedrivebackend Succeeded
Import of duplicity.backends.par2backend Succeeded
Import of duplicity.backends.pydrivebackend Succeeded
Import of duplicity.backends.rsyncbackend Succeeded
Import of duplicity.backends.ssh_paramiko_backend Succeeded
Import of duplicity.backends.ssh_pexpect_backend Succeeded
Import of duplicity.backends.swiftbackend Succeeded
Import of duplicity.backends.sxbackend Succeeded
Import of duplicity.backends.tahoebackend Succeeded
Import of duplicity.backends.webdavbackend Succeeded
Using temporary directory /tmp/duplicity-FyFCaQ-tempdir
Backend error detail: Traceback (innermost last):
File "/usr/bin/duplicity", line 1555, in <module>
with_tempdir(main)
File "/usr/bin/duplicity", line 1541, in with_tempdir
fn()
File "/usr/bin/duplicity", line 1380, in main
action = commandline.ProcessCommandLine(sys.argv[1:])
File "/usr/lib/python2.7/dist-packages/duplicity/commandline.py", line 1135, in ProcessCommandLine
backup, local_pathname = set_backend(args[0], args[1])
File "/usr/lib/python2.7/dist-packages/duplicity/commandline.py", line 1010, in set_backend
globals.backend = backend.get_backend(bend)
File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 223, in get_backend
obj = get_backend_object(url_string)
File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 211, in get_backend_object
raise BackendException(_("Could not initialize backend: %s") % str(sys.exc_info()[1]))
BackendException: Could not initialize backend: No module named paramiko
BackendException: Could not initialize backend: No module named paramiko
BackendException: Could not initialize backend: No module named paramiko
Comment peut-on expliquer que duplicity ne fonctionne que pour root ?
J'ai besoin de le lancer par user2, car c'est user2 qui a la clé ssh pour se connecter au serveur automatiquement, ubuntu (root) se fait jeter tout naturellement:
Using archive dir: /home/ubuntu/.cache/duplicity/1ec63264749cdf83763476f30c785f38
Using backup name: 1ec63264749cdf83763476f30c785f38
Import of duplicity.backends.acdclibackend Succeeded
Import of duplicity.backends.azurebackend Succeeded
Import of duplicity.backends.b2backend Succeeded
Import of duplicity.backends.botobackend Succeeded
Import of duplicity.backends.cfbackend Succeeded
Import of duplicity.backends.dpbxbackend Failed: No module named dropbox
Import of duplicity.backends.gdocsbackend Succeeded
Import of duplicity.backends.giobackend Succeeded
Import of duplicity.backends.hsibackend Succeeded
Import of duplicity.backends.hubicbackend Succeeded
Import of duplicity.backends.imapbackend Succeeded
Import of duplicity.backends.lftpbackend Succeeded
Import of duplicity.backends.localbackend Succeeded
Import of duplicity.backends.mediafirebackend Succeeded
Import of duplicity.backends.megabackend Succeeded
Import of duplicity.backends.multibackend Succeeded
Import of duplicity.backends.ncftpbackend Succeeded
Import of duplicity.backends.onedrivebackend Succeeded
Import of duplicity.backends.par2backend Succeeded
Import of duplicity.backends.pydrivebackend Succeeded
Import of duplicity.backends.rsyncbackend Succeeded
Import of duplicity.backends.ssh_paramiko_backend Succeeded
Import of duplicity.backends.ssh_pexpect_backend Succeeded
Import of duplicity.backends.swiftbackend Succeeded
Import of duplicity.backends.sxbackend Succeeded
Import of duplicity.backends.tahoebackend Succeeded
Import of duplicity.backends.webdavbackend Succeeded
ssh: Connected (version 2.0, client OpenSSH_7.6p1)
ssh: Authentication (publickey) failed.
Using temporary directory /tmp/duplicity-zj5VAG-tempdir
Backend error detail: Traceback (innermost last):
File "/usr/bin/duplicity", line 1555, in <module>
with_tempdir(main)
File "/usr/bin/duplicity", line 1541, in with_tempdir
fn()
File "/usr/bin/duplicity", line 1380, in main
action = commandline.ProcessCommandLine(sys.argv[1:])
File "/usr/lib/python2.7/dist-packages/duplicity/commandline.py", line 1135, in ProcessCommandLine
backup, local_pathname = set_backend(args[0], args[1])
File "/usr/lib/python2.7/dist-packages/duplicity/commandline.py", line 1010, in set_backend
globals.backend = backend.get_backend(bend)
File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 223, in get_backend
obj = get_backend_object(url_string)
File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 209, in get_backend_object
return factory(pu)
File "/usr/lib/python2.7/dist-packages/duplicity/backends/ssh_paramiko_backend.py", line 235, in __init__
self.config['port'], e))
BackendException: ssh connection to user2@80.xx.xxx.7:222 failed: Authentication failed.
BackendException: ssh connection to user2@80.xx.xxx.7:222 failed: Authentication failed.
gpg: WARNING: unsafe ownership on homedir '/home/ubuntu/.gnupg'
BackendException: ssh connection to user2@80.xx.xxx.7:222 failed: Authentication failed.
Dernière modification par RidingAround (Le 28/01/2020, à 15:33)
RAID 5 luks 4x1To - SSD M2 120 - RX 480 - 4x4 DDR4 - Xeon
24 ans de Linux ! Ubuntu aux particuliers -> puis aux entreprises -> monter des serveurs -> sécuriser les entreprises -> des armoires -> des clusters -> des conteneurs ... que du bonheur :}
Hors ligne
#2 Le 25/01/2020, à 16:09
- kamaris
Re : [RESOLU] Duplicity et paramiko : droits
C'est probablement dû au fait que tu as installé paramiko avec sudo pip, au lieu de pip.
Je connais une bonne manière de ne pas avoir de problème avec pip : ne pas l'utiliser
Il existe des paquets python-paramiko et python3-paramiko dans les dépôts, installe plutôt ça avec apt, tu auras probablement moins de problèmes… (en ayant d'abord désinstallé la version que tu as installée via pip)
Hors ligne
#3 Le 28/01/2020, à 15:33
- RidingAround
Re : [RESOLU] Duplicity et paramiko : droits
EXACT !
Ca marche maintenant !
Merci
RAID 5 luks 4x1To - SSD M2 120 - RX 480 - 4x4 DDR4 - Xeon
24 ans de Linux ! Ubuntu aux particuliers -> puis aux entreprises -> monter des serveurs -> sécuriser les entreprises -> des armoires -> des clusters -> des conteneurs ... que du bonheur :}
Hors ligne