9

Now I mount an encrypted folder:

  1. open browser and login to NAS gui
  2. click Control panel -> Shared Folder > Encryption > Mount
  3. enter key
  4. after folder is mounted:

    rsync -ah --progress --delete /path/* admin@ipadress:/volume1/path/ 

Can I bypass 1.-3. and use ssh only?

6
  • You're asking if you can run one ssh command that opens a browser, logs in to the NAS, clicks in specific places, enters a key, then runs an rsync command? Commented Jul 15, 2016 at 22:16
  • 1
    I can connect to NAS with ssh, therefore bypassing the gui altogether. If I can do this with ssh, I can automatize this process. Commented Jul 16, 2016 at 8:33
  • Does the key change every time? Commented Jul 16, 2016 at 12:32
  • No. The key is in an encrypted file, which I first open, then paste to NAS gui. Commented Jul 16, 2016 at 14:23
  • Does the "ssh" process need to open this encrypted file, or else how will the key be transmitted? Commented Jul 16, 2016 at 14:44

1 Answer 1

11

Use the gui to mount the encrypted directory, then login to the synology as root over ssh and type mount. You will see a line like

 /volume1/@mycryptdir@ on /volume1/mycryptdir type ecryptfs (rw,relatime,ecryptfs_fnek_sig=88...,ecryptfs_sig=88...,ecryptfs_cipher=aes,ecryptfs_key_bytes=32) 

This shows your directory /volume1/mycryptdir is implemented on an underlying /volume1/@mycryptdir@ directory using ecryptfs. Unmount the directory with the gui, then try the following command:

# ecryptfs-add-passphrase Passphrase: 

Type in the cleartext passphrase you originally used (not the .key file). It will reply

Inserted auth tok with sig [88...] into the user session keyring 

Now type the mount command using the options you saw before. You will need to create the mount point directory:

# mkdir /volume1/mycryptdir # mount /volume1/\@mycryptdir\@/ /volume1/mycryptdir/ -t ecryptfs -o rw,relatime,ecryptfs_fnek_sig=88...,ecryptfs_sig=88...,ecryptfs_cipher=aes,ecryptfs_key_bytes=32 

Your filesystem should now be mounted and useable. You should now clear the password from the in-memory keyring:

# keyctl clear @u 

When you have finished, unmount the directory with umount /volume1/mycryptdir.

1

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.