Remote access to Raspberry PI 3 in LAN

ssh
resinos
raspberrypi3

#1

I have a Raspberry PI 3 machine which runs the last version of resin OS.
I installed and enabled ssh, and I can successfully access the device in my LAN with putty.
I login as root user but, I don’t know the password.

My questions:

  1. Am I supposed to access that device remotely with this approach?

  2. If I’m supposed to, what is the password for root, or is there another user I should use to login?

  3. If I’m not supposed to, then is there a way to access my machine remotely, with ssh and if possible with ftp, so I can debug any bug if necessary and make file transfers easily?

Thank you.


Log to production host over SSH with direct ethernet cable?
Log to production host over SSH with direct ethernet cable?
Log to production host over SSH with direct ethernet cable?
#2

Hi @dbeqiraj, what do you mean by “installed and enabled ssh”, is it within your application? If in your application, you have to set your own ssh settings according to the server that you’ve installed.

What are you trying to access, the resin host operating system, or the application running on the device?

Are you running a “managed” resinOS version (that you can see in the resin.io dashboard), or an unmanaged version that you got from resinos.io?

There are a number of small notes:

  • a production version of managed resinOS does not have open ssh access, you can access the device through the resin.io VPN, using the dashboard, or through the resin-cli (the `resin ssh command, see more of the documentation at https://docs.resin.io/reference/cli/ )
  • a development version of managed resinOS has open SSH access, you can either log in to the host OS on port 22222, root user with no password, or you can use resin ssh for remote and resin local ssh for local access for either the host OS or the application (see more of the differences between dev and prod images in the docs at https://docs.resin.io/reference/resinOS/overview/2.x/#dev-vs-prod-images )
  • the unmanaged resinOS version is like the development one in terms of local access, but it is not accessible remotely

It would be good if you could provide a bit more information of what are you doing and what are you trying to do, for us to be able to help more.


#5

Hello @imrehg. Here are the answers for your questions one by one:

  1. What do you mean by “installed and enabled ssh”?
    In Dockerfile, I install ssh among with other stuff using apt-get install ssh.
    After the deploy I go in the dashboard -> Application -> Select Device -> Terminal (main selected as target, not Host OS). Here I do service ssh restart, and this goes well…
  2. What are you trying to access, the resin host operating system, or the application running on the device?
    I guess you can figure out from the answer of question 1 that I’m trying to access the application running on the device (I’m interested, if possible, doing file transfers in my application directory with a remote client, for example using WinSCP)
  3. Are you running a “managed” resinOS version (that you can see in the resin.io dashboard), or an unmanaged version that you got from resinos.io?
    I downloaded the OS from the dashboard (ADD DEVICE, the green button) and it is a development edition.

I’m having a look to the resin-cli now, and I guess that resin ssh will do the job for remote control in terminal. But, I’m also very interested about ftp. Is there anything we can do for that?

Thank you.


#6
  1. it depends on how are you installing ssh and what settings you use. For example, regular ssh installations are blocking root login, so you will have to enable that and enable passwordless access most likely , or set a password, or add your own authorized_keys files. Here’s an example project for that https://github.com/resin-io-projects/resin-openssh
  2. if you are trying to access the the application, then this route might work, but you won’t be able to access the device remotely, only on your local network. You can also use resin ssh to access the container, but we don’t provide scp access and file transfer like that. There’s resin sync that copies files over on local network into your application temporarily (as containers are ephemeral), so that’s only partially applicable for you. So if you want to do file transfers, you will have to find a different solution (e.g. running an the ssh server yourself, and expose it publicly in a different way, like using ngrok)
  3. make sense, thanks.

No FTP access to the device, for that you have to run your own ftp service, etc, as mentioned above in the case of ssh.


#7

Thank you, now I have an overview about the ssh and ftp part.
I also wanted to ask you about the database. Is there any way to access the database with a client in LAN?
To do so, I normally would need:

  1. The device IP (I have this)
  2. A user in the device (I have root)
  3. A password for the root user of the device (I DO NOT have this)
  4. A username and a password for the db (I have these)

I guess I cannot, but I’m asking you just to make sure…


#8

Not sure I understand, what database are you trying to access?

Also, root user for the device or the root in the application? (sorry if I’m repeating something just to clarify). The root in the host OS (the “device’s root”) doesn’t use password as it can be logged in only by an authorized key in production version, and can logged in freely in development version.
In your own application you set any passwords and access for any users that you might have.

So really I am just not clear about what are you trying to do.


#9

My web application, which is running in Raspberry PI, has a MySQL database. I meant how to access that database via a remote client.

Anyway this was the solution for all my problems in this topic for anyone who might have the same problems:

  1. Install a ssh and start that service (see above)
  2. CREATE A NEW USER (adduser <username>) via the terminal in the dashboard (main selected as target)
  3. Use that user for everything you need to do remotely, that is:
  • Use it for a ssh remote connection
    In Putty now you have all you need (IP + User + Password)
  • Use it for file transfer
    In FileZilla or WinSCP you have all you need (IP + User + Password)
  • Use it to access the db with a remote client
    Again here you have IP + User + Password, and you definitely have a username and a password for the database itself (the ones you use to connect the db to the application)

Anyway, thank you @imrehg for all the support.


#10

If the database exposes itself on the network, then you should be able to connect to, and not sure I understand whether the ssh side has any affect on the things.

Is it running in a multicontainer setup, or just a single container?

For example here’s a multicontainer demo, that has a database: https://github.com/resin-io-projects/multicontainer-getting-started That database just exposed within the device, not remotely, but modifying the Docker compose file would let you connect remotely as well, if you need to.


#11

Well the ssh side affects the access via a remote terminal and a ftp, ssh service should be running for these two.

It is running a single container setup, as far as I understand the difference between multi and single.