Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > PocketBook

Notices

Reply
 
Thread Tools Search this Thread
Old 12-03-2011, 05:10 PM   #1
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 2,977
Karma: 18343081
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
ssh shell/ftp access for PocketBook Pro readers

I've put together a package for running a secure shell daemon on the PocketBook Pro readers without needing root privileges. This allows one to use scp, sftp and ssh from a computer to access the reader. Unfortunately, because the daemon runs under the non-root reader account, it can't use passwords for logging in. Instead, authorization keys have to be used instead of passwords. This isn't difficult to do, but does make the set-up a little harder than just copying the files over and clicking the start application. I've attached the zip file with the necessary programs and scripts, and also attached the README.txt file from inside the zip file so people can judge if they want to bother with this or not.

The ssh shell is pretty rudimentary because of problems with creating ptys from non-privileged accounts. If enough people want this, maybe we can convince PB to fix that within their firmware.

The ssh programs were built using LoneTech's qemu-based build system. They are for arm-eabi systems only, so won't work on the older 30X and 360 systems. However, the configuration options for building the openssh package are given in the README.txt file, and anyone with an older arm build system should be able to create programs for the readers using the older ABI.

Edit: The first time you run sshd_start, it takes a while to run because it is generating host keys for the system. Please be patient.

Edit 2: Re-uploaded new files that include the "create-keys" functionality suggested by @apos.

Edit 3: Added sreader account as allowed login name, and updated README.txt. Users of new firmware versions should use sreader as the login name rather than reader

Edit 4: Added pop up dialog stating the IP address and port.

Edit 5: Added a version for devices with firmware 5 (since they use new openssl libraries).

Edit 6: Added a version for devices with firmware 6. Log in as user "reader" on those devices.
Attached Files
File Type: txt README.txt (7.9 KB, 2424 views)
File Type: zip pbsshd_1.3.zip (336.8 KB, 1206 views)
File Type: zip pbsshd_1.3_fwv5.zip (298.8 KB, 1224 views)
File Type: zip pbsshd_1.3_fwv6.zip (1,005.0 KB, 486 views)

Last edited by rkomar; 12-28-2020 at 03:49 PM.
rkomar is offline   Reply With Quote
Old 12-04-2011, 04:48 PM   #2
MartinZ
Zealot
MartinZ doesn't litterMartinZ doesn't litter
 
Posts: 110
Karma: 138
Join Date: Mar 2011
Device: PB903, PB603
ssh

Hi rkomar,

thanks a lot for that attempt.

I do not get logged in though:

Code:
sftp -P 1124 reader@192.168.2.34
prompts me for a password for user reader (which i do not know).

I created a key pair before and copied the public key to the "authorized_keys2" file.

Besides that:

i think a normal ftp instead of sftp could be even more useful. Windows users could connect via ftp in explorer this way (like it was possible by "get_root").
Even better a Samba server on PBs side would be to Windows users.
MartinZ is offline   Reply With Quote
Advert
Old 12-04-2011, 04:59 PM   #3
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 2,977
Karma: 18343081
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
Quote:
Originally Posted by MartinZ View Post
Hi rkomar,

thanks a lot for that attempt.

I do not get logged in though:

Code:
sftp -P 1124 reader@192.168.2.34
prompts me for a password for user reader (which i do not know).

I created a key pair before and copied the public key to the "authorized_keys2" file.

Besides that:

i think a normal ftp instead of sftp could be even more useful. Windows users could connect via ftp in explorer this way (like it was possible by "get_root").
Even better a Samba server on PBs side would be to Windows users.
Look in pb_sshd/sshd.log to see if the problem was logged. If not, you can edit sshd_start.app and change the "-q" option to sshd to "-d" to get even more debugging information. It looks like it isn't getting a match on the key. Maybe you can try the "-i" option with sftp to specify the exact location of the id_rsa (or whatever) private key file.

As far as the other stuff goes, I don't think you can run telnetd or ftpd as non-root user. The whole point of this was to provide something for a non-rooted device. I agree that the secure versions of ftp, telnet and rcp are much less common, but I don't see what else to do about it.
I haven't looked into running samba under a non-privileged account. I don't know if it is possible or not, but I'll have a look. I agree that it would be pretty useful.
rkomar is offline   Reply With Quote
Old 12-04-2011, 05:05 PM   #4
MartinZ
Zealot
MartinZ doesn't litterMartinZ doesn't litter
 
Posts: 110
Karma: 138
Join Date: Mar 2011
Device: PB903, PB603
log

Code:
/mnt/ext1/applications/pb_sshd/usr/sbin/sshd: /lib/libcrypto.so.0.9.8: no version information available (required by /mnt/ext1/applications/pb_sshd/usr/sbin/sshd)
MartinZ is offline   Reply With Quote
Old 12-04-2011, 05:50 PM   #5
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 2,977
Karma: 18343081
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
I've looked around a bit online, and apparently it is possible to run a samba server under a non-root account, but the port it listens on has to be above 1024. After a quick look, the only way I saw to get a Windows machine to access a different port is to map port 139 to the new one using ssh tunneling. The process is pretty involved, and needs putty installed on the system. If you have putty installed, then you might as well use it to copy files over to the reader's sshd server.

Anyway, I'm willing to give someone a hand building samba for the PocketBook Pro devices if they want to pursue this, but I don't use Windows much myself, so I wouldn't want to do the bulk of the work.
rkomar is offline   Reply With Quote
Advert
Old 12-04-2011, 05:51 PM   #6
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 2,977
Karma: 18343081
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
Quote:
Originally Posted by MartinZ View Post
Code:
/mnt/ext1/applications/pb_sshd/usr/sbin/sshd: /lib/libcrypto.so.0.9.8: no version information available (required by /mnt/ext1/applications/pb_sshd/usr/sbin/sshd)
This is just a warning. It doesn't actually affect anything.
rkomar is offline   Reply With Quote
Old 12-04-2011, 07:04 PM   #7
Seneca
Enthusiast
Seneca began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2008
Location: Germany
Device: Zaurus-5500G, PB-903, PB-603, Tolino Vision 2
Quote:
Originally Posted by rkomar View Post
The ssh shell is pretty rudimentary because of problems with creating ptys from non-privileged accounts. If enough people want this, maybe we can convince PB to fix that within their firmware.
Hi rkomar,

I have run into the /dev/ptmx problem earlier. Your work on sshd finally made me asking Fork to change the default access modes for /dev/ptmx. See my post here https://www.mobileread.com/forums/sho...31#post1863531
(the post is in the German forum, scroll down to see the English version)
Seneca is offline   Reply With Quote
Old 12-04-2011, 07:48 PM   #8
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 2,977
Karma: 18343081
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
Quote:
Originally Posted by Seneca View Post
Hi rkomar,

I have run into the /dev/ptmx problem earlier. Your work on sshd finally made me asking Fork to change the default access modes for /dev/ptmx. See my post here https://www.mobileread.com/forums/sho...31#post1863531
(the post is in the German forum, scroll down to see the English version)
Good. Maybe the more people ask for it, the more chance it will be changed. Did you not need to change the line for /dev/pts in /etc/fstab?
rkomar is offline   Reply With Quote
Old 12-05-2011, 06:25 AM   #9
jbaach
Connoisseur
jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.
 
Posts: 80
Karma: 20837
Join Date: Aug 2011
Device: prs 505, pocketbook 903, onyx boox m92
Thanks a lot for the sshd, rkomar - its fantastic to have it.

Because I am running 2.1.2 rc3, and don't know how to root it, I wrote myself a little ssh command line wrapper that allows me to still use ssh in a somewhat 'natural' way.

It needs python to be installed on your host, run it like 'python pbshell.py address', with address being the ip or hostname of the pocketbook (which defaults to pb in my local setup)

http://baach.de/static/pbshell.py

Last edited by jbaach; 12-05-2011 at 06:36 AM.
jbaach is offline   Reply With Quote
Old 12-05-2011, 12:35 PM   #10
Seneca
Enthusiast
Seneca began at the beginning.
 
Posts: 40
Karma: 10
Join Date: Jul 2008
Location: Germany
Device: Zaurus-5500G, PB-903, PB-603, Tolino Vision 2
Quote:
Originally Posted by rkomar View Post
Quote:
Originally Posted by Seneca View Post
I have run into the /dev/ptmx problem earlier. Your work on sshd finally made me asking Fork to change the default access modes for /dev/ptmx. See my post here https://www.mobileread.com/forums/sho...31#post1863531
(the post is in the German forum, scroll down to see the English version)
Good. Maybe the more people ask for it, the more chance it will be changed. Did you not need to change the line for /dev/pts in /etc/fstab?
No, I think /dev/pts is uncritical. At least on my local Linux system it has the same modes as on the pocketbook. You don't need write access there, because the ptyX nodes are created by the kernel (actually the devpts pseudo filesystem) and not by the application creating a pseudo tty pair.
Seneca is offline   Reply With Quote
Old 12-05-2011, 12:37 PM   #11
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 2,977
Karma: 18343081
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
Thanks jbaach. Unfortunately, my desktop machine is still using python 2.6, and so doesn't have the argparser module. However, I tried it on a virtual machine with python 2.7 installed, and it works nicely there. It _is_ an improvement over the bare, promptless, shell.
rkomar is offline   Reply With Quote
Old 12-05-2011, 01:39 PM   #12
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 2,977
Karma: 18343081
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
Quote:
Originally Posted by Seneca View Post
No, I think /dev/pts is uncritical. At least on my local Linux system it has the same modes as on the pocketbook. You don't need write access there, because the ptyX nodes are created by the kernel (actually the devpts pseudo filesystem) and not by the application creating a pseudo tty pair.
It seems to be important for sshd. If I leave the firmware defaults, I can log in via ssh but the shell has no pty and is missing many features. If I only change the permissions on /usr/dev/ptmx, then logging in via ssh fails completely (not even a broken shell). If I also add "gid=5" to the options for /dev/pts in /etc/fstab, then the ssh shell behaves perfectly when I log in.

It was when I was googling for similar ssh problems that I saw others suggesting the same changes for /dev/pty in /etc/fstab on other Unix systems. Perhaps this is only important for those applications that use the openpty() system call (like sshd does).

I noticed while googling that some sshd clones (dropbear?) use an openpty() clone instead of the actual system call. I think I'll take a look at that and see if it would work on a default PB reader.
rkomar is offline   Reply With Quote
Old 12-05-2011, 06:13 PM   #13
jbaach
Connoisseur
jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.jbaach can self-interpret dreams as they happen.
 
Posts: 80
Karma: 20837
Join Date: Aug 2011
Device: prs 505, pocketbook 903, onyx boox m92
Quote:
Originally Posted by rkomar View Post
Thanks jbaach. Unfortunately, my desktop machine is still using python 2.6, and so doesn't have the argparser module. However, I tried it on a virtual machine with python 2.7 installed, and it works nicely there. It _is_ an improvement over the bare, promptless, shell.
I updated my version at the link above - it now uses optparse :-)
jbaach is offline   Reply With Quote
Old 12-05-2011, 06:34 PM   #14
rkomar
Wizard
rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.rkomar ought to be getting tired of karma fortunes by now.
 
Posts: 2,977
Karma: 18343081
Join Date: Oct 2010
Location: Sudbury, ON, Canada
Device: PRS-505, PB 902, PRS-T1, PB 623, PB 840, PB 633
Quote:
Originally Posted by jbaach View Post
I updated my version at the link above - it now uses optparse :-)
Yes, that runs even with my python 2.6 package. I would recommend to people who want to use this to not use a passphrase with their private key, though, because it gets tedious typing it in after every command.
rkomar is offline   Reply With Quote
Old 12-26-2011, 05:17 PM   #15
apos
Zealot
apos solves Fermat’s last theorem while doing the crossword.apos solves Fermat’s last theorem while doing the crossword.apos solves Fermat’s last theorem while doing the crossword.apos solves Fermat’s last theorem while doing the crossword.apos solves Fermat’s last theorem while doing the crossword.apos solves Fermat’s last theorem while doing the crossword.apos solves Fermat’s last theorem while doing the crossword.apos solves Fermat’s last theorem while doing the crossword.apos solves Fermat’s last theorem while doing the crossword.apos solves Fermat’s last theorem while doing the crossword.apos solves Fermat’s last theorem while doing the crossword.
 
apos's Avatar
 
Posts: 126
Karma: 28670
Join Date: Dec 2011
Location: Ludwigshafen, Germany
Device: 623 Touch Lux, 912 Pro (selled), Surfpad 4 L, Waiting for CAD-Reader !
Hi rkomar,

first of all: thanks for your software and "merry chrismas"

I tried "pbsshd" on a new PocketBook 912 Pro but had no luck. I get a "connection refused".

I am an old school linuxer and know how to connect and configure ssh-client and -server with keys, but I didn't succeed in this case. Unfortunately, i cannot get the poterm to run on the device.

Code:
ssh -vv -p 1124 reader@192.168.178.35
OpenSSH_5.8p1 Debian-7ubuntu1, OpenSSL 1.0.0e 6 Sep 2011
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.178.35 [192.168.178.35] port 1124.
debug1: connect to address 192.168.178.35 port 1124: Connection refused
ssh: connect to host 192.168.178.35 port 1124: Connection refused
ssh_config is a standard ubuntu one:
Code:
Host *
    SendEnv LANG LC_*
    HashKnownHosts yes
    GSSAPIAuthentication yes
    GSSAPIDelegateCredentials no
    ServerAliveInterval 120


Short question: is this version binary compatible? It seams to be, because a log-file is created, so the daemon seams to be running:
Code:
/mnt/ext1/applications/pb_sshd/usr/sbin/sshd: /lib/libcrypto.so.0.9.8: no version information available (required by /mnt/ext1/applications/pb_sshd/usr/sbin/sshd)
Any clues?

THX in advance
Axel
apos is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Root / Shell / Term / SSH / editor on a Kindle 2? JDShaffer Kindle Developer's Corner 2 12-13-2010 06:11 PM
Can't get shell access MarkRPenn iRex 11 10-26-2007 06:58 PM
Shell Access ? grayfox iRex 6 10-14-2007 04:56 PM
FTP access open to new developers Alexander Turcic Announcements 2 05-05-2007 11:02 AM


All times are GMT -4. The time now is 02:40 AM.


MobileRead.com is a privately owned, operated and funded community.