I'm trying to launch two applications in my server using SSH remote connection. These applications are using D-BUS message bus for communication.
If I login to my server computer locally, the communication between these applications works perfectly. However when I try to launch these applications remotely, errors related to D-BUS occurs.
Is there any way to share D-BUS message bus when starting applications remotely on server computer?
My server is running on Ubuntu 12.04.
Finally found a solution to my question.
First I needed to start ssh connection with trusted X11 forwarding enabled:
ssh -2 -Y user#address
In this remote connection I started the application first application with new D-Bus: dbus-launch --autolaunch=machineID app1. Then I opened new SSH connection and also started second application together with D-Bus with the command dbus-launch --autolaunch=machineID app2. MachineID can be found from ~/.dbus/session-bus/ in Linux environment.
That is how I was able to make this two applications to use the same D-Bus message bus in remote connection.
Related
Use case is web service intended to run as an appliance on a headless Raspberry Pi. OS: Raspbian (Debian).
The web service is running under a non-root service account, using a custom-rolled Boost Beast-based web server (avoid!).
What I want to do: provide a button in the web interface, running in a remote user's browser that allows the system to be shut down or rebooted.
What I've tried so far ... (C/C++)
system("/usr/sbin/shutdown -P now"); // (or -r for reboot)
Fails with the messages:
... [3460]: Failed to set wall message, ignoring: Interactive authentication required.
... [3460]: Failed to power off system via logind: Interactive authentication required.
... [3460]: Failed to open initctl fifo: Permission denied
... [3460]: Failed to talk to init daemon.
I also tried creating a wrapper executable that has been SUID-ed to root, that in turn calls system("/usr/sbin/shutdown ...") with identical results. So even with root credentials, shutdown fails. (Also tried /sbin/reboot, which also fails).
The service in question is written in c++, and services a web socket. The web client app sends a web socket request to shut down the system; and the shutdown is performed in the C++ server code. Everything works fine when the server is started in an interactive session; but it does not work when running in a systemd service.
The web server itself is running as a systemd service using a system account (so no login credentials, and I really do not want login credentials for the service account).
I'm perfectly willing to reconfigure the system, or create a service specifically for this purpose if necessary, and to do what I can to address security issues. But I have no clue as to what the path forward is. The issue is particularly pressing because there's no shutdown button on an out-of-the-box Raspberry Pi (although I do plan to address that for my own Pi). The fact that one CAN install a shutdown button on a Raspberry Pi means there must be some what to do it.
Ideally, I'd like to leave the R-Pi in a state that's usable for other purposes. So a no-password boot into a shell isn't an attractive option. I don't think. And rsh-based solutions are unattractive because they would require the appliance to have a preinstalled login account, with pre-installed credentials (and we all know how THAT goes).
I solved the same issue by creating a C++ daemon, running as root, and listening ONLY on local host TCP port, in charge to shutdown the system when contacted by the web service.
Edit: Use https://man7.org/linux/man-pages/man2/reboot.2.html to shutdown the OS.
I have set up SAMBA to act as an AD DC and my machine connects to it fine but when I try to find the Active Directory tools from inside my windows machine I get the error 'naming information cannot be located because: the rpc server is unavailable'
I have no idea what thats bout and the few cases ive seen online deal in different situation not applicable to my case.
The problem can be on either the client or server machine.
Make sure Samba is listening on the right ports. RPC is on port 135. If you don't see Samba listening on port 135, then that's your problem.
Also make sure that, on your client Windows machine, the "TCP/IP NetBIOS Helper" service is running (in services.msc) and set to run automatically. If that was not running, then that's your problem.
Have a nodejs - socketio application kiosk running windows 7 in kiosk mode(desktop).
Occasionally on boot a handshake doesn't occur between socketio and the client app also running on the same pc. There is a connection but it is immediately dropped. This happens randomly roughly 5% of the time on reboot
The only way I've been able to reliably get the handshake working is to manually reboot the pc.
I can see the nodejs trace showing the lost connection when the error occurs.
I was wondering is there was a way for nodejs to dynamically reboot its host pc (in this case running Windows 7)?
Windows has the shutdown command: How do I shutdown - restart - logoff Windows via a bat file?
You should be able to spawn an process to execute that.
I have a remote machine that runs Ubuntu 14.04. It is powered on, but not logged into. I am writing a web application using Node.js that takes a username and password and logs in to this machine. This application is supposed to run on an Android tablet. I am not going to send further commands through the terminal, so I don't really require the session, but just logging in so that the remote machine starts running some processes.
I'm having trouble on how to start coding this. I'm not sure about what Node module to use, and whether or not to use the SSH protocol.
I've gone through a couple of solutions to related questions on the internet, but they either don't work on Android, or need the remote machine to be running some server already(which is not the case here, as the machine is not logged into).
I am facing an issue in deploying my Qt GUI executable on to the iMx6 target. I am running Ubuntu 12.04 on VMWare, and launching the Qt executable using Qt Creator 3.1.2 (running Qt 5.3.1 cross compiled for iMx6 platform). The error message displayed was:
19:08:58: Could not connect to host: SSH Protocol error: Server and client capabilities don't match. Client list was: ssh-rsa,ssh-dss.
Server list was ecdsa-sha2-nistp256.
Is the device connected and set up for network access?
19:08:58: Deploy step failed.
Error while building/deploying project qtGUI (kit: Target)
When executing step 'Check for free disk space'
19:08:58: Elapsed time: 00:02.
It is purely some problem related to network connection ? or something that am missing here ?
Any help is appreciable. Thanks.
Your server just allows certificates using ecdsa-sha2-nistp256, while your client just allows ssh-rsa and ssh-dss. Since there is no match between both lists, its not possible to connect to the server.
Your server wants to exchange keys explicitly using Elliptic Curve nistp256. Your client does not know about this method, therefor denies the key-exchange. you will have to update your client SSH certification methods (update ssh clientlibrary) or set your server to allow other certification methods.
I got the same problem when I wanted to connect to the board PicoCOMA9X (NXP i.MX6) through SSH in Qt creator and could solve it in the following way:
Delete all of host keys generate in your board. They are usually located in /etc/ssh. You can use rm ssh_host_*.
Restart the ssh session by using /etc/init.d/S50sshd restart.
Then check the IP, username and password of the board in Qt, and test the connection.