Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Adobe AIR Development

Reply
Developer
peter9477
Posts: 3,831
Registered: 12-08-2010
My Carrier: none

Re: How to enable/connect with SSH?

@thadude3, I'm fairly sure /etc/ftpusers is not used by sftp, just for real FTP.

 

On the other hand, I think one of the messages in that thread you linked suggests that /etc/passwd should be readable by all users.  I noted somewhere (losing track of all the threads) that it's not readable by devuser, and if it's needed to translate the user name to uid or vice versa, maybe that explains the failure.   Maybe I can set up a test on one of my linux boxes to reproduce and demonstrate that's what's wrong, unless QNX can just confirm that someone went overboard on security by making /etc/passwd unreadable except by root.  (In spite of the name, it does not contain actual passwords, but merely user-related metadata that is, I believe, generally considered harmless.)


Peter Hansen -- (PlayBook and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru | Get more from your battery! Power, voltage, life.
Please use plain text.
Developer
peter9477
Posts: 3,831
Registered: 12-08-2010
My Carrier: none

Re: How to enable/connect with SSH?

Yep, I'm pretty sure that's it.  With "chmod o= /etc/passwd" on a linux box, I get similar results, with scp and sftp not working, and "unknown user 1000" showing with "sftp -v" for an attempted login by a user with uid 1000.

 

Elena, if you're reading this, do we need to file bug reports in Jira for something like this or is anyone collecting problem reports by reading these threads?  It would be pretty inefficient if I have to carefully collate all this info into a credible bug report if someone there can just file an internal one saying "/etc/passwd not readable by all users, make it readable so devuser can see it for scp/sftp logins".


Peter Hansen -- (PlayBook and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru | Get more from your battery! Power, voltage, life.
Please use plain text.
BlackBerry Development Advisor
elena_laskavaia
Posts: 406
Registered: 10-27-2010

Re: How to enable/connect with SSH?

> Elena, are you sure about all that, and that's it's meant to be working with the 0.9.2 simulator?

Peter - it meant to be working but it does not :smileysad:

Hopefully will be fixed in the next update. Why do you need ssh anyway?

Please use plain text.
BlackBerry Development Advisor
elena_laskavaia
Posts: 406
Registered: 10-27-2010

Re: How to enable/connect with SSH?

try to use scp instead of sftp

Please use plain text.
Developer
peter9477
Posts: 3,831
Registered: 12-08-2010
My Carrier: none

Re: How to enable/connect with SSH?

 


elena_laskavaia wrote:

try to use scp instead of sftp


 

As noted above in this thread, I already did.  The same problem affects both sftp and scp.

 

The problem stems from the (incorrect) permissions set on /etc/passwd.  Someone at QNX/RIM probably got carried away with permissions, thinking that file needs to be protected from reading.  In fact, /etc/passwd should be "world-readable", as many programs use it to map user names to uids and vice versa, among other things.

 

On a regular Linux system, doing "chmod o= /etc/passwd" and invoking scp and sftp-server results in these outputs (where user phansen has uid 1000).

phansen@tank:$ sudo chmod o= /etc/passwd
phansen@tank:$ /usr/lib/sftp-server
No user found for uid 1000
phansen@tank:/etc$ scp
unknown user 1000

On the simulator, here's the output for the same thing (where devuser is uid 100):

$ /usr/libexec/sftp-server
No user found for uid 100
$ /usr/bin/scp
unknown user 100

Given that scp and sftp operate by invoking scp and sftp-server (respectively) on the remote end of the connection established by ssh, and given that I see those same error messages on the local end (on my host machine) when I use the "-v" options, I'd call it conclusive that the permissions on /etc/passwd are the cause of this problem.  Fixing that should resolve it.

 

(I'll respond to your "why use SSH?" request in a separate message, to preserve message threading for anyone who views the forum that way.)

 


Peter Hansen -- (PlayBook and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru | Get more from your battery! Power, voltage, life.
Please use plain text.
Developer
peter9477
Posts: 3,831
Registered: 12-08-2010
My Carrier: none

Re: How to enable/connect with SSH?

 


elena_laskavaia wrote:
Why do you need ssh anyway?

 

While I don't necessarily need SSH, I need some mechanism for reading/writing files that my app can read/write, mainly for testing purposes.

 

I assume the real PlayBook will allow us to connect it to a PC as a "mass storage device" to read/write files, at least those in the shared ("user") folders.  I'd like to be able to do the same thing on the simulator.

 

In addition, it is very useful if I can also retrieve the contents of my applicationStorageDirectory's for my apps, even if that's not possible on the actual device.  This lets me check that they have the correct content (i.e. inspecting persisted "state" of an app), as well as contriving various fake failure conditions (corrupted data) to verify error handling.

 

Lastly, it lets me build test fixtures that I can use to supplement the limited features of the existing simulator, at least until they manage to add more of the features.  For example, I can have a program running on my PC taking photos with the camera, and transfer those via scp (or any other means you have available) into the device, where a "mock" Camera class is configured to retrieve those images and pretend that it took them as snapshots.

 

At the moment, the best I've been able to do is to launch python2.7 in the simulator, and run a small script on a timer that retrieves files with ftplib from my own ftp server, writing them into the /accounts/devuser folder, which I've made world-readable for my apps.  It's extremely crufty.... and only covers part of the above.


Peter Hansen -- (PlayBook and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru | Get more from your battery! Power, voltage, life.
Please use plain text.
Developer
peter9477
Posts: 3,831
Registered: 12-08-2010
My Carrier: none

Re: How to enable/connect with SSH?

I've posted an article about some workarounds for the problem with scp/sftp

 

I haven't taken the final step described, of a fully automated bidirectional transfer using timed async file copies in the app, a Python 2.7 script on the simulator, and an FTP server on the host machine, but I'd be interested to hear if someone goes that route.


Peter Hansen -- (PlayBook and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru | Get more from your battery! Power, voltage, life.
Please use plain text.
Contributor
Dani78112
Posts: 17
Registered: 04-01-2008

Re: How to enable/connect with SSH?

Hi,

I am little bit lost using ssh tool. i have downloaded bitvise.. tried to connect but still stop here.

 

what is it ''submethods'' password dev mode does not work.

playbook ssh error.png

 

 

 

Please use plain text.
Developer
tags07
Posts: 386
Registered: 12-12-2010
My Carrier: Sprint

Re: How to enable/connect with SSH?

Thank you Peter and Elena... so my next logical qn is will this be supported on the actual hardware?

Will we have root access?...i think i know the answer but still wanted to ask ;-)

Please use plain text.
Developer
tags07
Posts: 386
Registered: 12-12-2010
My Carrier: Sprint

Re: How to enable/connect with SSH?

 

I was able to get connected using WinSCP on windows using SCP. 

I got the following Error  :

 

error.jpg

 

 

But when i clicked OK.. i was able to get this:

 

scp.jpg

 

NOTE: I used SCP not SFTP when connecting:

 

 

scp1.jpg

 

 

Please use plain text.