synology DSM 6 : accéder aux fichiers domoticz

Forum dédié aux problématiques concernant les scripts pour DomoticZ.
Entourez votre code et les logs avec les balises nommées code grâce au bouton <\>.
alexbi
Messages : 123
Inscription : 29 nov. 2015, 16:36

synology DSM 6 : accéder aux fichiers domoticz

Message par alexbi »

bonjour

j'ai bien galéré pour contourner le problème d’accès aux fichiers de domoticz sur mon synology. Je m'explique depuis la mise a jour DSM 6, on ne peut pas se connecter via WinSCP comme avant, car il faut maintenant être en "sudo" pour pouvoir "modifier" les fichiers !

j'ai trouvé la solution sur le net et je peux dire que cela fonctionne ! que du bonheur de pouvoir retrouver mes fichiers .lua lol

donc voici ce que j'ai trouvé,qui j’espère aidera certains : (attention dans le tutos il explique qu'il faut taper ":wq" et pas juste wq comme moi j'ai fais lol)


(1) Download PuTTY and PuTTYgen (or just get the installer, everything is in there).

(2) Generate a keypair with PuTTYgen (Parameters: SSH-2 RSA)

(3) Save the private key as “myprivatekey.ppk”

(4) Copy the public key to the clipboard. Looks somewhat like this :

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAzP4MR3lkCD2pa7nwT3NMjjDBMmEuJ4exW4GKBBP+okArZ/IrjbLIpdh8ahpfgjh8kM//OVUGeRa1GigzcCuGzIa2YfS7L4Q9cbUUWFwIu2hGV3ZpJ2xDZExaaLH90Vw+ZBaozD2OI4FZ1Dqh8Bj29SQqIIbmxf/ASyTmXHZCbQk= rsa-key-20130414
(5) Connect to your diskstation with PuTTY

diskstation:22
(6) Login as root admin (obviously the root will not work on DSM 6 ... so use any administrator account like the original "admin")

(7) Elevate your admin user to "root" by typing (then all your command lines will have to be precidered by "sudo " to be executed as "root") :

sudo -l -U root
*** Steps 8 to 10 are probably optional based on CoolRaoul comments .... based on my experience, sudo remains needed otherwise you will not have the rights to open / change files ***



(8) Edit the SSH config with

sudo vi /etc/ssh/sshd_config
(9) Look for the following lines (using the keyboard arrows up & down) :

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys
(10) Change them to this (by hitting “x” when the cursor is over the # and hitting ESC, then typing :wq ENTER).

There is not visible effect after having hitted ESC ... do not search and type :wq ENTER

#RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
(11) Go to /root and create the .ssh folder

(the .ssh dir was already existing in my DSM ... try to go directly to 12.

IF the step 12 is not working ... then type

sudo -s
Then, type

cd /root
mkdir .ssh
Then, type

Exit
(12) Edit the keyfile

sudo vi /root/.ssh/authorized_keys
(13) Press “i”, paste your public key (right clic) and save the file (Hit Esc, type :wq, hit Enter)

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAzP4MR3lkCD2pa7nwT3NMjjDBMmEuJ4exW4GKBBP+okArZ/IrjbLIpdh8ahpfgjh8kM//OVUGeRa1GigzcCuGzIa2YfS7L4Q9cbUUWFwIu2hGV3ZpJ2xDZExaaLH90Vw+ZBaozD2OI4FZ1Dqh8Bj29SQqIIbmxf/ASyTmXHZCbQk= rsa-key-20130414
(14) Set the access-rights to the file

sudo chmod 700 /root/.ssh
sudo chmod 644 /root/.ssh/authorized_keys
(15) Disconnect with

exit
(16) Open Putty again and make the following settings

In session :

Hostname or IP
Port: 22
Connection type: SSH
In Connection

Data->Auto-login username: root
SSH->Auth->Private Key: Your Keyfile
In session, save the session as <sessionname>

(17) Open WinSCP

Add a new site
Select "SFTP"
Add the Hostname (or IP) and SSH port
Add as username "root"
In Advanced > SSH > Auth > Auth parameters : select the same SSH key file as in (16) and tic the option "allow the connection agent"
Save and log
vil1driver
Messages : 5661
Inscription : 30 janv. 2015, 11:07
Localisation : Rennes (35)

Re: synology DSM 6 : accéder aux fichiers domoticz

Message par vil1driver »

Salut,

Joli travail merci du partage,

J'aime aussi mes fichiers lua et je comprends que tu ais eu envie d'y avoir accès à nouveau.
Mais saches que tu peux faire tes scripts lua directement dans l'interface comme pour blocky..
Ils sont dans ce cas dans domoticz.db et seront donc sauvegardés (si tu fais tes sauvegardes)
MAJ = VIDER LE CACHE(<-Clicable)
/!\Les mises à jour de Domoticz sont souvent sources de difficultés, ne sautez pas dessus
modules.lua

Un ex domoticzien
alexbi
Messages : 123
Inscription : 29 nov. 2015, 16:36

Re: synology DSM 6 : accéder aux fichiers domoticz

Message par alexbi »

oui tu as raison la mise a jour de domoticz m'a bien aidée !

mais tu te doutes bien que je ne cherchais pas l’accès juste au fichier .lua :D
Kspr411
Messages : 1
Inscription : 31 mai 2017, 00:04

Re: synology DSM 6 : accéder aux fichiers domoticz

Message par Kspr411 »

Merci Alexbi,

j ai essayé ta manip qui est bien détaillée (je suis novice en code)

après cafouillage à l étape 13 ou 14 ( je sais pas bien ou ca a merdé) je n ai plus l acces à mon syno via son adresse ip (le DSM) ou via putty ou autre
par contre j ai un raccourci réseau sur mon bureau et je vois bien mes fichiers ?

j ai fait un reset et repart de zero.... grrrrrrrrrrrrrrrrrr
Répondre