Invoking an application running on mac vmware from parent Windows OS - windows

Is there a way we can invoke an application installed on mac lion vmware from a program or web application running on windows OS?
Thanks,

Configure remote login on the Mt Lion instance,
Now you can connect over SSH, and invoke commands. (on Windows use Putty / Plink)
e.g. if your VMWare instance is on 10.0.0.1 and login is username.
plink 10.0.0.1 -l username "open -a Chromium.app http://google.com"
Setup ssh keys to do this without password challenges.
If you weren't running windows...
Just do an ssh call.
ssh username#10.0.0.1 "open -a Chromium.app http://google.com"
Alternatively
Run a very simple web service on the Mac, and have it run commands supplied locally.
This is pretty easy if you use Sinatra or something lightweight and similar (sammy.js for node is apparently based on sinatra.)
Do something like this, from the Mac terminal:
sudo gem install sinatra
create a file called app.rb
require 'sinatra'
get '/' {
`#{params[:command]`
}
Then launch it:
ruby app.rb
Now open the following URL on the windows box
http://10.0.0.1:4567/?command=open%20-a%20TextEdit.app
Again, assuming the VM instance IP address is 10.0.0.1
TextEdit will open on the Mac VM.
Security & notes...
This would allow any command that is at the privilege level of the logged in user, fine for launching apps, but not good for anything that requires further interaction, for that you're better off writing a local script on the Mac VM and calling it via similar means to those I've described.
Secure it...
Of course no security on this, but you could add it reasonably simply, if ssh wasn't possible, and it'd depend on your requirements.
Adding a simple security token to the request:
get '/' {
`#{params[:command]` if params[:token] == "awSomEl3yS3cuReP4ssK3y"
}
Sending the request as:
http://10.0.0.1:4567/?token=awSomEl3yS3cuReP4ssK3y&command=open%20-a%20Safari.app
You can beef it up further by various means, but this is enough to get you going. Rack (which sinatra uses to provide the http service, will allow you to setup modules, ie. basic http auth, or more advanced authentication, as you see fit.

Related

Firefox in AWS instance

I tried to install firefox on my redhat 8 machine.but I get
" running firefox as root in a regular user's session is not supported. ($xauthority is /run/user/1001/gdm/xauthority which is owned by user.) "
Then I try it as normal user then it shows another error.
" Failed to open connection to "session" message bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Running without a11y support! "
How to install firefox in Rhel8 (AWS EC2)? Is this possible?
I assume you are connecting via ssh (text mode). Firefox needs a graphical environment to run, which is not available in EC2. You will need a text-only browser.
It seems to me that you need something like WorkSpaces, not ec2 with ssh.
https://docs.aws.amazon.com/workspaces/index.html
The minimum you also need to install with firefox would be the xauth package. This should let you run firefox both as a normal user and while su to root. As root you will need set the XAUTHORITY env variable to point to your .Xauthority file, e.g.
# export XAUTHORITY=/home/sbaby/.Xauthority
This assumes, of course, that you ssh to your server with a X11 server listening for connections. Refer to your ssh client for documentation on how to set that up.

Connecting to Telnet through a macOS program

I am currently trying to code an application for a macOS to control an Arduino. To do this I need to be able to access telnet and send string commands to it. Any ideas on how to do so?
telnet is insecure, inflexible and out of fashion - folks use ssh now. There is no longer even a telnet client in High Sierra.
Create an empty file called ssh in the partition of your SD card called boot to get in the first time. Then ssh in with:
ssh pi#<RASPI-IP-ADDRESS>
and password raspberry.
Then use:
sudo raspi-config
to enable ssh for future boots.

Logging to Adobe CQ5 using PuTTY

I would like to learn about connecting to the CQ5 server using Putty SSH/telnet client for windows to perform operations like server start/stop, check status etc
I tried connecting, but got connection refused.
If anyone could help with the steps to connect, it would be useful.
Thanks,
Sriram
This is not CQ5 related!
If the server you are trying to connect to is not offering ssh access you won't be able to connect this way. Maybe you are trying to connect to a windows-server? Try remote-desktop in this case.
The below is the Example that might be useful when you are using a putty client from windows, and the CQ5 is hosted in the Linux box.
open the putty window, provide the details
1)HostName or (Ip Address)
Example: 192.168.1.1
2) Enable SSH radio button(which defaults to port 22)
then click on open which prompts you for the linux box username and
password.
Then navigate to the bin folder which is inside of your
crx-quickstart folder is located.
Example: Navigate to "/CQ5/Author/crx-quickstart/bin/"
Use "sh start" or "sh stop" commands to run start and stop scripts of the CQ. Some more info
You can list the process which are up and running on which address by " netstat -lnptu " command
Use " kill -15 PID " for killing a process with specific process id (Example : kill -15 5574)
Apache Felix provides a shell that allows you to interact with the OSGi framework and with shell extensions that CQ5 or applications that run on it can supply. Maybe that's what you're looking for.
Installing the org.apache.felix.shell, org.apache.felix.shell.remote and org.apache.felix.shell.tui bundles provides a remote shell that's accessible via telnet 6666 by default.
Adding the org.apache.felix.gogo.command, org.apache.felix.gogo.runtime and
org.apache.felix.gogo.shell bundles activates the richer Gogo shell.

Run script on remote machine via telnet (not SSH)

I need to somehow run a script which resides on a remote machine running Ubuntu.
SSH or any other connection type that requires complex encryption is not possible.
The client that will connect to the remote machine is only capable of opening a port and sending and receiving strings.
Can anyone tell me how to do this?
Why is your remote Ubuntu machine "not natively capable of SSH". That's nonsense.
But if you want a solution, use expect - it can run ftp/telnet or any other terminal-based application. It can react to different input, and type in a password.
There are python and perl-based packages that also do this.

How to Connect to localhost with SSH(PuTTy)

I just figured how to connect to my webhost with PuTTy .
But how to I connect to my localhost? I put
Servername: localhost
port: 22 (I've tried 80 too)
And it gives me an error "failed to connect"
How do I connect?
If you are using Cygwin on your local host, you can connect to Cygwin's sshd (SSH Daemon).
3 easy commands to install the sshd as a service: (always there when you startup the machine)
$ ssh-host-config -y # enable sshd. "-y" answers yes to all queries.
$ cygrunsrv --start sshd # start it as an autostart Windows service
$ ssh localhost # try to recursively log in via ssh
Taken from: http://nfnaaron.posterous.com/tag/puttycyg#Section2
(The second approach)
=> You get the entire ssh infrastructure: public key authentication, ssh-agent, etc...
Ensure that you have running a SSH server (such as openssh-server) running on localhost and not just a web server (such as apache). Also ensure, that localhost is really mapping to 127.0.0.0/8
The solution in the answer above won't work unless you have installed Cygwin with the OpenSSH package selected - you have to do this manually during the installation process (see option a below).
Depending on the intended purpose of your connection you can try one of the options below, option (b) being much easier to install but lacking the *nix shell capabilities.
a. You can install a Cygwin shell with ssh server, this site (http://ist.uwaterloo.ca/~kscully/CygwinSSHD_W2K3.html) has instructions for Windows Server but they work for other Windows too with may be some of the questions shown in the output on the page not appearing on non-server version of Windows. Also, where it says in the instructions to issue the command:
mount -s --change-cygdrive-prefix /
delete the -s option so that the command is
mount --change-cygdrive-prefix /
(at least this was the case for me on Windows 7).
b. PuTTy site suggests WinSSHD (http://www.bitvise.com/winsshd-download). It's an easy self-installer. Once it's up you have to click onthe StartSSHD link about 1/3rd of the screen down on the first page of the config window. Then you can connect your PuTTy to localhost. However, in my experience, it didn't provide any *nix command support, only the native Windows ones and I couldn't find anything in their user guide on this.
Hope this helps.
Just adding this answer in case anyone is still looking for a solution.
In your hostname (or IP address) section, enter localhost or 127.0.0.1
Leave the port to its default value 22
Click on open
Now a login shell will popup -
Log in as your username, your username is basically what you get when you type whoami in your Terminal.
In the password section, type the password that you use as your system's password.
The above steps should connect localhost with ssh(PuTTY)

Resources