From: Jeremy Bopp Date: 2010-10-28T21:41:54+09:00 Subject: Re: Executing ruby command is not working from windows to mac connected by putty On 10/28/2010 06:33 AM, Arihan Sinha wrote: > Hi All, > > I want to delete some files from Mac system where I am in the windows > sytem. > > System1 ( win7) logged in with userid :- arihan.sinha > > system2( Mac system 172.20.10.65 name:- developers-iMac.local) loggedin > with userid :- developer > > I am using putty to connect system1 to system2 where priviate key is in > my window system1 and public key in mac system2. > > puts %x[c:\\Program Files (x86)\\PuTTY\\plink -i > "C:\\Users\\arihan.sinha\\.ssh\\authorized_key.ppk" > developer@developers-iMac.local "pwd"] > > %x[c:\\Program Files (x86)\\PuTTY\\plink -i > "C:\\Users\\arihan.sinha\\.ssh\\authorized_key.ppk" > developer@developers-iMac.local "cd Library"] > > puts %x[c:\\Program Files (x86)\\PuTTY\\plink -i > "C:\\Users\\arihan.sinha\\.ssh\\authorized_key.ppk" > developer@developers-iMac.local "pwd"] > > %x[c:\\Program Files (x86)\\PuTTY\\plink -i > "C:\\Users\\arihan.sinha\\.ssh\\authorized_key.ppk" > developer@developers-iMac.local "cd > Library/Caches/Google/Chrome/Default/Cache"] > > puts %x[c:\\Program Files (x86)\\PuTTY\\plink -i > "C:\\Users\\arihan.sinha\\.ssh\\authorized_key.ppk" > developer@developers-iMac.local "pwd"] > > all cases its giving output as > /Users/developer > /Users/developer > /Users/developer > > Can anyone please guide me If I am doing any mistakes. This all seems to be working very well, so you have proven that you can use SSH to log into the Mac system. If you want to run your Ruby script on the Mac, you will need to have the script on the Mac as well as an installation of Ruby. This method of accessing the Mac via SSH only lets you run remote commands directly on the Mac. You cannot run a command on your Windows system and have it do something directly with the Mac's filesystem. If you want to try to access the Mac's filesystem directly by using a script running on the Windows machine, you should be able to do so using SFTP. Look up the Net::SFTP module for Ruby. -Jeremy