General :: SSH Into A Windows PC And Run A Command From PHP Script?

Jul 28, 2009

I am trying to SSH into a windows PC and run a command from a PHP script Here is a typical command I am trying to execute, I also need to run a batch file on the windows box.

Code:

ssh user@192.168.10.131 cmd /c dir

The above works fine when typed into a terminal window on the Linux server but when I put that in my PHP script it refuses to work The following is a fragment of code from my PHP script

Code:

$command = 'ssh user@192.168.10.131 "cmd /c dir"';
$return = shell_exec("$command");
Server = Linux (SME) with PHP5
Client = WinXP Pro

View 6 Replies


ADVERTISEMENT

General :: Copy A File From Windows With Scp Command?

Aug 18, 2010

I would like copy a backup file from image vmware linux to windows but i don't know how to process it ?i tried :scp /source/backup.tar.gz admin@x.x.x.x:/c:ProgrammefilesC:Documentsand SettingsAdminMyDocumentsbut error and i know that it's not like that, so if you have solutions

View 2 Replies View Related

General :: What Is The Windows Analog Of The Watch Command

Sep 21, 2010

I'm looking for a Windows program/script/command line function that works like Linux's watch program. watch periodically calls another program/whatever and shows the result, which is great for refreshing an output file or similar every second: watch cat my-output.txt or, more powerfully: watch grep "fail" my-output.txt I've looked for it in cygwin's library, but it doesn't seem to be present.

View 3 Replies View Related

General :: What Is The Equivalent File Command For Windows

Apr 18, 2011

Running the command: file run.sh Gives me: run.sh: Bourne shell script text executable in Linux. Is there an equivalent command in Windows?

View 4 Replies View Related

General :: Run A Remote Command On A Windows XP Machine?

Jun 24, 2011

I'm using Ubuntu 11.04. I have a Windows XP box in which I've installed SFU 3.5 and Interix (Subsystem for Unix-based Applications). I want to run a batch script on the Windows machine from my Linux box, whether on-demand or in a cron. How do I do this from the Linux side?

View 4 Replies View Related

General :: Command Prompt Ftp To Ftp Server Running On Windows?

Dec 27, 2010

I am using on Windows Vista, Filezilla server. I have it set up to be accessed via outside IPs and when I use a client on the IP I have it connects normally using Filezilla client. On the same machine I have Ubuntu running in a virtual box and when using filezilla client in there it works fine. Now I want to try the command prompt. So I do the ftp xxx.xxx.xx.xxI enter the name and password and i get the ftp command prompt, but the commands are not working properly. when trying "ls" or "cd" these commands do not work. "cd" tells me that the current directory is "/" root, but this does not make sense in the windows operating system. Now the filezilla client is taking the user in the application window directly to the root folder of the permitted filespace granted to that user. How can the same be done from the command prompt, if there is a way? It is as if the command prompt takes me to the root which does not exist or even have correct permissions to move in. Is there any way to be taken to the correct directory directly, or move there especially when the slashes are the wrong way around etc?

View 1 Replies View Related

General :: Incremental Copy Command Similar To Windows?

Jul 28, 2011

Any please help me for incremental copy command similar to windows.commad for copying in windows is c: source xcopy *.* destination /s/c/d/q/yany similar command is there in linux as I m new in Linux

View 4 Replies View Related

General :: Put Windows Xp In The GRUB Boot Command For Mint?

Apr 3, 2010

I have Microsoft Windows Xp installed on my Primary Drive C: and I had a Mint boot disc that I would pop in and load from. Well I got tired of this disc and installed a new hard drive in my computer so I could use Mint as a secondary OS. Everything went good in the install, and I put Mint on the second drive. But when I boot my computer the GRUB menu only shows Linux Helena Mint 8 to load from and no Xp. Xp is still currently installed on the computer in the Primary drive, but how do I inlcude it in the GRUB boot menu or boot it at all?

View 2 Replies View Related

General :: SSH Client And Command Prompt Replacements Windows Look-and-feel?

Jun 9, 2010

I've worked exclusively in Windows. I can handle that.I've worked exclusively in DOS (a long time ago!). I can handle that.I've worked exclusively in Unix.I can handle that.Right now, I am developing a command-line (python) application on a Windows machine, testing it in a DOS box (i.e. Windows' Command prompt), and then deploying it to Linux, and running it with PuTTY.

I cannot handle that. My productivity drops dramatically when CTRL-C cuts in one window (Windows) and kills the process in another (DOS, Linux).My productivity drops dramatically when Enter copies the selection in one window (DOS), and deletes the selection in another (Windows), and runs the current half-edited command in the third (PuTTY).My productivity drops dramatically when I cannot hit Undo, Home or End.The Solution I am Seeking

An SSH/Bash command-line client that runs on Windows and, to the extent possible, uses all the standard Windows shortcuts (Cut, Copy, Paste, Undo, Home, End, Insert, Shift-Arrows, etc.) work on a bash command line. Bonus points if it puts the cursor between letters, rather than on them.Plus, an equivalent DOS command-line drop-in that runs on Windows, and provides the same interface.need to be special buttons to actually transfer CTRL codes (like CTRL-C) through in the cases I need them.I suspect the SSH client will need to be specific to a shell (so it knows when it is at the command prompt, and when it is inside a running app.)I know there are many SSH clients, but I am looking for advice for a particular need.PuTTY feels like an escape route for Unix programmers stuck on Windows. I am the opposite.Can anyone recommend one (or maybe a combination of an SSH client and an Command-Line replacement)?

Update: After seeing the early answers here, I turned my requirements into a blog article, which may give more background in the direction I am looking.

View 4 Replies View Related

General :: Navigate To Previous Directory In Windows Command Prompt

Mar 24, 2011

Possible Duplicate: Navigate to previous directory in windows command prompt

Is there an equivalent of Linux's cd - (change to previous directory) in Windows?

View 3 Replies View Related

General :: Windows Command Prompt Auto-completion With Forward Slashes?

Jul 26, 2011

I switch between Linux and Windows quite a lot and it's annoying the hell out of me that the Windows command prompt won't auto-complete directory paths when I press Tab if I use forward slashes like in Linux.For example, if I'm trying to navigate to a directory 'bin':

cd /path/to/dir/b <tab> - this won't auto-complete to 'bin'
cd path odir <tab> - this will auto-complete.

Can I tell the Command Prompt to use forward slashes instead?

View 1 Replies View Related

General :: Is There A Windows Equivalent Of The Unix "strings" Command

Mar 25, 2010

strings in Unix and Linux extracts printable strings from a binary file. Is there a version of this for Windows? I couldn't find one.

View 2 Replies View Related

General :: Ubuntu 10.10 And Command Line Scripts - Error - Android: Command Not Found

Mar 26, 2011

I know my way around MS Windows much better, but I just don't feel right trying to program something for Android on a Microsoft operating system. I am interested in Android programming so I followed the instructions on [URL] to install the environment on my computer...

I just installed the JDK, SDK, Eclipse successfully (or I assume):

* When I get to Step 4 where I'm supposed to run 'android' it will not run. I get the error message "android: command not found" (I am definitely in the right directory).

** When I double-click it in nautilus, it opens up in gedit. I can set the permissions in nautilus (through the properties - Allow executing file as a program) and get it to work,

My system:

Intel i7
Ubuntu 10.10 Maverick Meerkat
android-sdk-linux-x86
eclipse 3.6.2

View 5 Replies View Related

General :: Append Command Output To File By Giving Command In Terminal?

Jul 3, 2009

I am using openSUSE 10.3.When I install software from tarball then to record time required I send output of date to beg.txt(when installation begins) and end.txt (when installation finishes).How can I append output of date to a file so I don't need two files?

View 4 Replies View Related

General :: Access The Dbxml From The Command Line And It Returns Command Not Found?

Apr 30, 2011

I installed the Berkeley DB on the Ubuntu server and tried to access the dbxml from the command line and it returns command not found

path/to/dir/dbxml-2.5.16/install/bin$dbxml
-bash" dbxml: command not found

Can someone point me in the right direction

View 1 Replies View Related

General :: Set Up New Keybinding For Finding Last Command Executed Using The First Few Characters Of The Command In Csh?

Jul 21, 2010

I want to be able to use Ctrl+R to have reverse-i search. Also if I press Shift+Up Arrow after typing the first few characters of a recently executed command then the shell should complete the command by finding the most recent commmand having the same first few characters.

View 1 Replies View Related

General :: Bash Command History Update Before Execution Of Command

Jun 7, 2010

Bash's command history is great, especially it is useful when adding the history -a command to the COMMAND_PROMPT.However, I'm wondering if there is a way to log the commands to a file as soon as the Return key is pressed, e.g. before starting the command and not on completion of the command (using the COMMAND_PROMPT option would save the command once the prompt is there again).

I read about auditing programs like snoopy and session recorder like script but I thought they're already too complex for the simple question I have. I guess that deactivating that script logs all the output of the command would lead already in the right direction but isn't there a quicker way to solve that probelm?

View 1 Replies View Related

General :: How Does Cp Command Determine Source And Destination Locations In Command?

Apr 14, 2011

When you run the following cp command in the BASH terminal, how does Linux know which files are the source and which are the destination when copying multiple files from one location to another?How does Linux know that the services, motd, fstab, and hosts files are the source and the /home/fred/my_dir is the destination?This question came up in a Linux class and I was not sure of the answer. I was thinking it is based on the source path entered ending with a file path and the destination being a directory, but was not sure.

View 4 Replies View Related

General :: Redirecting STDOUT Of Previous Command To STDIN Of Next Command

Nov 20, 2009

i'm trying to redirect the output of a command to the input of the next command. not sure if i'm going about this the right way. an easy method would be just to store the output of the previous command in a file and redirect input to read that file, but i'm curious to see if this can be done without writing to any files.

View 9 Replies View Related

General :: What Does This Cryptic Bash Command Mean - Why Command Crashes

Mar 20, 2011

Possible Duplicate: What does this cryptic bash command mean? Why this command crashes Linux? :(){ :|:& };:

View 4 Replies View Related

General :: Remote Command Execution Via SSH And Newgrp Command?

May 9, 2011

Up until now I've been using plink to remotely compile a project I'm working on. But recently the administrator from the remote server updated the distribution and messed up some configurations. My project has a lot of scripts written for tc shell (tcsh), and now the default shell is bash. There is no way to change this. Another problem is that now I need to run newgrp to change my default user group.

So... to work around this problem I've changed my .bashrc to run newgrp and then tcsh. If I do a normal connection using SSH, everything works as expected, but when using plink, or SSH to remotely execute commands, the shell gets stuck on the newgrp command. I think it's because both applications need a return value from newgrp to send the command I need to execute. Remotely running scripts that call a shell also get stuck like newgrp (newgrp also opens a new shell and that's why it gets stuck) my .bashrc is as follows:

Code:

user_grp=`id -g`
if [ $user_grp != 4919 ]; then
newgrp new_group_id
else

[code]....

View 4 Replies View Related

General :: Use This Command It Will Ask The User To Enter Year In Command?

Apr 4, 2011

i want in the website they ask to enter some input.Code:echo -e "<p>Please Enter Year : c</p> "read Yearif i use this command it will ask the user to enter year in command. but what i want is they ask the user to enter year in web browser.

View 14 Replies View Related

General :: Disable The Su Command On A Server So That Users Cant Run The Su Command?

Apr 29, 2010

i want to disable the su command on a server so that users cant run the su command i removed the comment from the 3 and 5 line in /etc/pam.d/su file but it doesnt seem to work the file is shown below

#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.

[code]....

View 8 Replies View Related

General :: Command To Delete Bash Command History?

May 31, 2010

What's the command to delete bash command history?

View 4 Replies View Related

General :: Only Execute 2nd Command On Successufl Execution Of 1st Command?

Aug 19, 2009

I have a script which builds a project and then runs junit tests. However, if the build fails, the junit tests fail with the same error message.Therefore the command which runs the junit tests should only be executed if the build was successful.

View 3 Replies View Related

General :: Redirecting Command Output To Input Of Another Command?

Jul 2, 2011

I want to run gsettings list-schemas (which return a list of about 100 names separated by spaces)and somehow direct each name one at a time as the input to this command:gsettings list-recursivelyI've tried it with awk, and standard | piping and also as a string variable strvar=$(gsettings list-schemas) and using the $strvar as the input butam missing something in between I'm sure like for - while or proper syntax of awk etc

View 3 Replies View Related

General :: Use Output Of Previous Command As Parameter To Another Command?

Nov 13, 2010

I want to use the output of a previous command as a parameter to another command. For example: to know where "nice" is stored i typed: which nice output: /usr/bin/nice now the second command i typed is: ls -l /usr/bin/nice Is there a way to have a single command like: ls -l which nice ?

View 4 Replies View Related

Ubuntu :: Bind The Windows Key To Run A Command (by Itself)

Jun 28, 2010

So I just upgraded to ubuntu 10.04 and I noticed that my favorite keybinding no longer works as it used to. On previous versions of ubuntu and on other distros, I was able to bind the left windows button to open a terminal _directly_ (i.e. not act as a modifier key for combos like "win + r"). Unfortunately, they changed the behavior of the key so that it has to be a modifier, and the old methods I used to circumvent this no longer work (I would go into gconf-editor and set the run-command-terminal" option to be run with "Super_L").

View 3 Replies View Related

Ubuntu :: Navigating A Windows Box From Command Line?

Oct 9, 2010

I'm in Ubuntu and want to navigate the directories of a Windows box upstairs. I can see it and navigate around the shared folders using the file browser (the address bar shows smb://computername/shared-directory/) but how do I navigate around using the command line? The IP addy of the upstairs computer is 192.168.0.199.FYI: If this is posted somewhere else I couldn't find it

View 4 Replies View Related

Ubuntu :: Using Dd Command To Get Image Of Windows Machine?

Jul 20, 2011

this is a procedure that was put in place before i got here. We basically just install windows and then use this command to create the image

dd if=/dev/sda | gzip -c | split -b 2000m /mnt/foldername/filename.img.gz.

i have been using this for a close to 2 years but have recently run into a problem where i am only getting part of the image. This is the first windows 7 64 bit machine that i have done it on so im not sure if that has to do with it.

the error im getting is dd: reading '/dev/sda' : input/output error

it is erroring out at the exact same point everytime i try it.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved