Im trying to run a .bat file on my server through php popen command, ive struggled and finally got to the point where all the permissions are set correctly and now i can actually execute the file but i have a problem. In my server logs it displays
foo.bat: line 1: mstsc: command not found, referer: http://dev.example.com
The full code in the file is mstsc /v:192.168.1.1 I know this means that it doesn't recognise the command on centos but im not sure what to do to fix the problem.
The aim of this code is to open RDP for the user who requested it. Bear in mind that this code works perfectly locally on my windows OS using xampp but when i upload it to the server running CENTOS it doesnt work.
My question is
How do i fix this error and allow CENTOS to execute a command that opens an RDP window for the user
MSTSC is a Windows RDP client which is why it works on Windows.
It's not available to run on CentOS, let alone call by executing a Windows batch file! You'll need to use an alternative solution like FreeRDP and use a script like this one if you want to do this from CentOS: https://www.server-world.info/en/note?os=CentOS_7&p=x&f=5
I feel like this is exactly what you're after
http://www.jjclements.co.uk/2010/02/21/rdp-hyperlink/
It allows you run a bat file that opens windows RDP without needing to write a single line of server code. Take a look its pretty good!
Related
Quick background: I previously used a remote Linux server for a project. Here I was able to pull up the Linux command window in the directory where files from another program were located, and enter a command such as lspp c= example_file.cfile -nographics. LSPP in this case is short for LS PrePost - through this command I was able to call LSPP in the background and have it reference the given *.cfile which contains various commands to be executed, such as depositing a given *.csv file with results, its name, etc.
I recently managed to install LSPP for windows locally, and am now trying to essentially translate the functionality of the command I executed in Linux, to Windows. I should add that I have no experience with CMD or Windows PowerShell...
The first thing I tried was to use cd C:\.... to set the directory to where the *.cfile is located and then enter the same lspp c= example_file.cfile -nographics from Linux, however, the response was that "lspp" was either spelled wrong or could not be found.
Next I tried setting the directory to the LSPP program folder, and using start LS-PrePost-4.7-x64 to at least start the program, but this didn't work either.
I would really appreciate it if someone could point me in the right direction here - thank you!
I have been working with linux's version of XAMPP (named LAMPP) for about 3 months now and up until tonight XAMPP has worked fine, but suddenly when I tried to run the command
sudo xampp stop
it gave me this error message:
XAMPP is currently only availably as 32 bit application. Please use a 32 bit compatibility library for your system.
and since then any time I try to run any of the following commands:
sudo xampp start
sudo xampp stop
sudo xampp restart
I get the same message
I want to know why I got this message because xampp has been working flawlessly up until now and in fact, less than 30 minutes ago, I typed sudo xampp start and xampp started up normally and I was able to access localhost/phpmyadmin/
Here is some other info that may be useful:
-My OS is Arch Linux
-I am using the xfce desktop environment
-In the time between starting xampp successfully and trying to stop xampp when I got the error message above, I was trying to get the php mail() function to work by following the steps on this page http://www.absolutelytech.com/2010/07/18/howto-send-emailsusing-mail-function-from-localhost-in-php-through-msmtp-using-gmail-account-on-linux/ and I had just successfully finished step 1 and successfully sent the test email to myself.
-also, when I first got the aforementioned error message, I was still able to access pages via localhost (for instance I had a php file at /opt/lampp/htdocs/Brown/index.php that I could access successfully by typing localhost/Brown/index.php even after I was getting the error message) but then I tried to restart my computer to see if that might fix the issue and now I can't start xampp to begin with.
Please someone help me with this and feel free to ask any follow-up questions if that will help
I figured out my own issue. For anyone who sees this question, I had made a few changes to my php.ini file in attempts to get php's mail() function to work and I wanted to start fresh, so I moved php.ini to php_old.ini and copied a file named php.ini-pre1.7.2 to php.ini thinking that php.ini-pre1.7.2 was a file containing the default configuration of php.ini in case one might want to roll back to the defaults, but instead it is something entirely different. My issue was completely fixed when I moved php_old.ini back to php.ini
2021 and the same happened to me after trying to match php.ini seetings between a Windows environment and a Ubuntu 20.04 one. Everywhere I saw it told me to comment a section in the /opt/lampp/lampp file but it messed up my installation and I lost track of what was wrong. After re-installing LAMPP I matched the settings one by one restarting with sudo opt/lampp/lampp restart at each modification. The culprit was:
browscap="C:\xampp\php\extras\browscap.ini"
This line has to be stay commented (just put a semicolon at the start of the line), if you need it then this workaround may help you. Cheers!
I am using winSCP GUI to connect to linux terminal and then copy the files and other stuff.
Now i have some scripts on the UNIX server,I am connected but how to run the script from the Win SCP.
what basically is needed is
sh scriptname.sh through the WinSCP.Please let me know if anyone else found out how to do that.AS loging into putty and running the command is time taking for me.
WinSCP Custom Command option tried to click on Execute,but the error pops up like no such directory.
Tried google but to the point information is not coming up.
Try this
sh "!"
OR
First of all executing commands from WinSCP can be tricky and if you are able to run few commands also,there are restrictions which you can not do fro WinSCP and should have to ultimately take help of PUTTY.
Here is the link Integrate WinSCP with Putty which will help you integrate your WinSCP to Putty,so that when you open any server through WinSCP putty will automatically connect without even asking for the password.And then you can run you command,hope that wound be of any trouble to you.
Remember you can store the connection details in WinSCP and in just one click it will connect to the server on SCP and also on Putty.
You can define your own custom command by right-clicking, selecting Custom commands and selecting Customize. Then click "Add", enter a description, e.g. Run and specifying a custom command. Try sh "!" to start with - that works ok for me, if you still get errors post your output back here. The quotes are important - only the exclamation should be quoted.
Right click the script > Custom Commands > Execute
Hope this helps.
To execute an ad-hoc shell command in WinSCP, use the Console window:
To execute the shell script selected in a file panel, create a custom command like:
sh "!"
This is actually, what the pre-defined custom command Execute (almost) does.
I'm aware that you claim that this does not work. But it should work in general. If you are having problems, please tell us details (exact error message, screenshot, anything)
You can have WinSCP open PuTTY terminal client and execute the commands there.
With some setup you can even open the PuTTY in the same directory as you have opened in WinSCP file panel.
Particularly for long-running commands/scripts, you can create a local custom command that runs the script via Plink:
"C:\Program Files (x86)\PuTTY\plink.exe" -ssh !U#!# "!/!"
Check the Use remote files option. Do not forget to select the Local command.
You can also pass the command to PuTTY to using similar method as used for Opening PuTTY in the same directory.
I've been practicing with "hello world" examples of websockets and node.js server.
According to all those examples you create a html file (client) and a js file (server).
Before you run them, you have to run this on the command line (I use windows)
node nameOFtheServer.js
So, my question. If I close the command line window and open it again the client does not connect to the server. I have to run again the above code in the command line , manually, so the server will start again. Why is this happening? Is that normal? How can I fix it , so I dont have to run the same commands over and over again on the command line in order to start the js file (server) ?
Thanks
EDIT
OK, new facts, I just edited the question, highlighting the changes in Italics
When you close the terminal, everything that runs in it is killed. There are many solutions on both Linux and Windows systems, most of them create some sort of a service which then runs in the background.
Here are some possible solutions:
http://blog.nodejitsu.com/keep-a-nodejs-server-up-with-forever
https://github.com/indexzero/daemon.node
http://www.coretechnologies.com/products/AlwaysUp/Apps/RunNodeJSAsAService.html
http://coreybutler.github.io/node-windows/manual/#!/api/nodewindows.Service
Pick the one that is best for you.
Related question on StackOverflow:
How to run node.js app forever when console is closed?
First of all thanks Venemo for your anser. I tried use the forever module, but did not worked well, as you can see here.
So I decided to use nssm with node.js
I download the nssm and unzip it in the C:Program Files\path\to\nodejs. And then I opened Window's command window and typed C:\program files\path\to\nssm-2.16\win32 and then typed nssm.exe. You should see a "menu" how to install or remove services. And now type
"C:\Program Files\path\to\nssm.exe" install give-Your-Service-A-Name "C:\path\to\node.exe" \"C:Program Files\nodejs\path\to\yourServerFile.js"
Notice the \ before the "C:Program Files\nodejs\path\to\yourServerFile.js" it's not a typo, you should type it, is important, if you have spaces in your path, helps nssm to interpret correctly.
And that's it, now press CTRL+ALT+DEL, open the Services tab, and find give-Your-Service-A-Name , right click and select Start service. To check, open your client file that communicates with the yourServerFile.js, it should be working, without having to start the yourServerFile.js from command line.
(PS : I use nodejs 0.10.12 and nssm 2.16 on windows 7. The instructions above are a combination of this tutorial and this anser)
I'm trying to open up a Unity3D game.exe that is on a remote computer through my main desktop. I had tried to do this through a batch file, but was advised to try PsExec in its place.
So far, I've brought the Psexec program into my game.exe folder. I run the command line required to open the program and the window opens up for a fraction of a second before closing down due to an error. The error code it gives is: -1073740771.
I tried googling what this error actually is but I can't find anything. Does anyone know what this error relates to?
The command line I type is as follows:
psexec \\OtherComputer -i C:\Administrator\Users\Desktop\TargetFolder\Target.exe
I even tried the above line with -d after the -i, quotes around the C:... but it all results in the same thing.
PSExec wont know about other game resources that live without side the EXE. It will simply copy game.exe to the remote machine and execute it.
Try deleting or renaming the resource folder and running it on your local machine - it should do the same thing as its doing on the remote machine.
You cant do what you want with psexec unless the entire application is self contained within one single .exe file.
You may be able to manually copy the resource folders if you have admin access to the other machines and administrative shares are enabled, then execute with psexec using the -w option:
Copy the files to \\OtherComputer\C$\MyGame
Run psexec \\OtherComputer -w C:\MyGame -i C:\Administrator\Users\Desktop\TargetFolder\Target.exe
Might work ;o)
Use the -h parameter to elevate the permissions.