RSS Amplifier

BurgeonLab: Full-text · Aug 22, 2024

How to SSH into KOreader (Kobo eReader) from macOS

0
Sign in to vote or save

Naty S · BurgeonLab

Guide to use KOReader on a Kobo eReader with SSH mode to wirelessly transfer ebooks. Includes instructions and config file template.

This post was last updated 2 years ago. The core ideas should still be useful, but tech moves fast; always check the latest docs for current best practices before applying what is mentioned.

Background

I bought my first e-reader (a Kobo Aura One Limited Edition) recently and right away I chose KOReader as my main software to read and manage my ebooks. KOReader allows for direct USB transfer, Calibre wireless transfer and also SSH. It was easy to use the former two options but I had trouble using SSH to connect to the Kobo using my Mac (on Sonoma 14.6.1) despite following the instructions.

Problem

Even with the two “workarounds” listed, I was not able to connect. The two workarounds offered are:

  1. When scp fails use: cat src_file | ssh -T -x -p 2222 user@ip 'cat > dst_file'
  2. Or use lysncd-workaround as a scp or rsync replacement for when remote doesn’t support scp or rsync.

Fix

It took me some trial and error to get lysncd to work and transfer files over via SSH to the Kobo, but it’s a great alternative to Calibre wireless transfer now that I have it sorted. Here are detailed instructions on how to use lysncd with KOReader SSH mode on a Mac to transfer ebooks (or any other file) to your ereader wirelessly with a CLI.

  1. Install lysncd brew install lsyncd.

  2. Make a config file (in lua syntax), call it .no-tty.lsync by touch .no-tty.lsync and then open the file with your preferred text editor - I use VSCodium. Change the language mode to .lua. (I made it a hidden file by adding the dot to the front. It’s up to you.) Paste in the template below, I added some notes to explain the variables.

  3. Save the config file in the working directory cd /Users/JohnDoe/Documents/KoboKOReader/.no-tty.lsync.

  4. Turn on WiFi and SSH mode (no password if on safe/home network, turn off immediately after done with transfer) in KOReader on the Kobo. Set a unique port number and note down the IP address in the popup window.

  5. In your working directory, run sudo lsyncd .no-tty.lsync Remember to type sudo because it doesn’t work and throws an error without it. "Cannot access /dev/fsevents monitor! (1: Operation not permitted)".

  6. If for some reason it is still not working, try giving terminal.app full device access in System Settings > Privacy & Security > Full Disk Access > add Terminal.app. Restart terminal. and repeat step 5.

  7. Whatever is in the source directory will be synced over. Once that has completed, click ctrl+c to end the process.

  8. Remember to keep WiFi on and do not allow the Kobo to sleep during transfer.

 1
 2settings {
 3    logfile    = "/dev/stdout",
 4    nodaemon   = true, -- If you started lsyncd in the foreground (for example, with nodaemon set to true), you can stop it by pressing Ctrl+C in the terminal where it is running. This will send an interrupt signal to lsyncd, causing it to terminate.
 5    inotifyMode = "Polling",
 6 }
 7
 8 port = 1234 -- Enter port set on KOReader network ssh settings
 9 remote = "root@192.169.1.1" -- Enter ip address for KOReader when you turn on ssh mode
10
11 ensure_target = function(event)
12     local cmd =
13     -- connect to server and go to dst dir
14         'sh -c \'ssh -T -x -p '..port..' '..remote..' "sh -c \\\"mkdir -p \\\\\\\"'
15         ..event.target..
16     -- write files
17         '\\\\\\\" \\\" " \''
18
19     os.execute(cmd)
20 end
21
22 up = function(event)
23     local cmd =
24     -- go to src dir
25         'sh -c \'cd "'
26         ..event.source..
27     -- read files
28         '"; tar cf - "./'
29         ..event.path..
30     -- connect to server and go to dst dir
31         '" | ssh -T -x -p '..port..' '..remote..' "sh -c \\\"cd \\\\\\\"'
32         ..event.target..
33     -- write files
34         '\\\\\\\"; tar xvf -\\\" " \''
35
36     spawnShell(event, cmd)
37 end
38
39
40 bash = {
41     maxProcesses = 2,
42     onCreate = up,
43     onModify = up,
44     onDelete = "echo 'deletion not supported: ^targetPathname'",
45     onMove   = "mv ^o.targetPathname ^d.targetPathname",
46     onStartup = function(event)
47         ensure_target(event)
48         up(event)
49     end,
50 }
51
52 sync{bash,
53     source="/Users/JohnDoe/Documents/KoboKOReader/", -- Files in this directory  will be copied over to the target destination whenever lsycnd is running, ctrl+c to end process
54     target="/mnt/onboard/destination_folder_name", -- Files from source directory (above) will be copied over to this target destination
55 }

Hope this helps! Happy reading with KOReader.

Photo of a Kobo Aura One in night light mode.

Reading at night is awesome

Read the original on burgeonlab.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.