Run the Mechanize::Firefox script in VNC server using Net::SSH::perl? - perl

I have done the script with Mechanize::Firefox. I need to run the script in VNC server. I'm working on ubuntu. I have installed krdc software to run the scripts.
Before running the script I'm starting the vnc server by using the following command vncserver.
To connect the server via ssh I have using one password for example sshpassword. When open the krdc software there I'm using the vncpassword.
My problem is, I have trying to run the Mechanize::Firefox script using Net::SSH::perl script it is running but the firefox is not starting. So I cannot crawl the content.
How can I fix this issue.? I don't know from where need to start.

Related

How an output of Windows application executed on remote SSH server gets to a local SSH client

I'm using PuTTY to connect to an SSH server running on Windoes 7.
When I issue powershell in PuTTY terminal does it mean that the powershell command window opens on the remote machine?
If so how does the output from remotely running powershell window gets routed to PuTTY client?
Sorry if this is lame question but it's not so obvious to me.
While the PowerShell is executed on the remote machine, no window opens on the server.
powershell.exe is a console application. Console applications have a standard IO (input and output). If you run a Windows console application locally, Windows GUI creates a console window and binds the application IO to the window. While if you run a console application via an SSH server, the SSH server binds the application IO to the SSH shell session. So anything that the PowerShell prints, gets routed to the SSH shell session output, which ultimately renders in your local SSH client window (PuTTY).
In other words, a local PowerShell window is rendered by Windows GUI (the system that executes the PowerShell), not by the PowerShell process itself (contrary to windows of GUI applications). Another system, like the SSH server, can choose a completely different "rendering" of the IO, like routing the IO to the SSH shell session.
It's the same process like, if you use ls command on a *nix server. The ls is also a console application. (Afaik, all *nix applications are actually console applications, what is not true on Windows.)

Execute remote PowerShell script from VSOnline fails - Access Denied

I am facing a very strange issue trying to run a Remote PowerShell script from the new build system of Visual Studio Online.
Context:
I have a Build server that I host on my own VM. I have also created a second VM where I want the PowerShell script to be run on.
When I run a build from the Build server, I want to create a task that run a PowerShell script on a remote machine. Sounds easy.
Both machines have everything configured to run the Remote PowerShell. (I think)
Problem:
If I manually run the script from the build server, the script is properly executed on my remote machine.
But, if I run the script by starting a new build, it doesn't work, I always get an error message
New-PSSession : [xxx.cloudapp.net] Connecting to remote server xxx.cloudapp.net failed with the following error message : Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.
Have you faced this issue before with VSOnline?
This can happen if there isn't a trust relationship between the remote machine and the build machine. E.g. you could look at the hosts.equiv file on the remote machine and make sure it trusts the build machine.
If that doesn't help then more info might be needed, like how you're trying to sign in, what build agent account you're running as.
Guy

Connecting to a remote CentOS machine

I am trying to connect to a remote system which has CentOS running on it from a Windows machine. I am getting the following error:
My remote computer is on and is available on the network. I tried following the steps mentioned on this website http://www.techotopia.com/index.php/Remote_Access_to_the_CentOS_6_Desktop to enable remote access on centos as well.
Currently I can access the remote sever through commandline utility like Putty only.
I use VNC for remote GUI admin work on CentOS device's from windows its nice and easy to set up and use, below are links to CentOS 6.5 set up guide and 7
https://www.howtoforge.com/vnc-server-installation-centos-6.5
https://www.howtoforge.com/vnc-server-installation-on-centos-7
Let me know how you get on :)
As posted by PaulM, I followed the steps in the website to install VNCServer on the centos machine.
To connect from my linux machine, I wrote the following commands:
vncviewer
IPAddress:5901
Adding the port number specifically made it work
CentOs to centOs Only
No Need Any Softwares Already Centos have TigerVnc Viewer
1.Enable Remote desktop in your centos system
Goto System-->Preference-->Remote Desktop
**i.Enable allow other user to view your Desktop**
**ii.Enable allow other user to control your Desktop**
**iii.You must confirm each access to this machine allow or cancel**
**iv.if you ask any password to enable and type your password**
Notification Area:
Some one connect your system its enable to shows the icon on top panel.

How to uninstall a service on remote machine using powershell?

I am a newbie in powershell script. I want to uninstall a service on remote machine and re-install it again. I am able to stop the service, change the files that service is using and again start it.
But, now I want to completely uninstall it.
One more thing, I will be executing these scripts via TeamCity.
I have tried following ways, but each one is giving trouble:
using wmi class
running installutil command on remote machine. But, cant execute this on remote machine since there is problem in accessing that service.
Using Get-WmiObject command and then calling delete() on retrieved service.
Is there any promising solution ??
Any help will be appreciable..
After playing a lot with TC and many commands, finally I got my answer to uninstall a service on remote computer, and its working properly.
I have made use of "wmic" command and provided the remote computer name, username and password for /node:, /username:, and /password: parameters. And, provided 'installutil.exe' command to be executed remotely. Here, the actual command is..
"wmic /NODE:$serverName /USER:$userName /PASSWORD:$password process call create '$path_to_installutil_exe\installutil /u $exe_location_path_of_service'"

How to invoke a perl script on the remote unix server from my local system

I have a perl script that should execute on the log files in the remote server from my local desktop. Could some one suggest me best approach.
I used Net::SFTP but there is a problem with installing SFTP package from CPAN. Is there any good package available in Perl to do this functionality?
Can you tell me whether the following steps are fine?
Open SFTP connection with remote server
execute the perl at remote location from the established connection..
Any sample code for this?
If you mean that the Perl script is on the remote unix server and you want to invoke the Perl script from your local machine, then you can ssh into the remote unix server and then once you are connected, call your perl script using perl yourscript.pl.
If you mean that the Perl script is on your local machine and you are dealing with log files on the remote server, then it would be more efficient to have the Perl script located on the remote server that stores the logs, and invoke it in the way described in the above paragraph.
I'm not clear exactly what you are trying to achieve but if you just want to execute a Perl script on a remote server you may want to look at software specifically built for remote server management.
Tak is one such piece of software but it's quite new and a bit lacking in documentation.
Rex is a more mature, it would seem, piece of software for remote server management.
Both of these should allow you to run commands locally that perform actions remotely on your servers. I wouldn't have thought you'd need to do anything with SFTP and would think you could do it all with those or hand-rolling something with commands over SSH.
Instead of Net::SFTP, try using Net::SFTP::Foreign or, if you want to run commands on the remote host via SSH, Net::SSH2 or Net::OpenSSH .