Executing ruby command is not working from windows to mac connectedby putty

A

Arihan Sinha

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"
(e-mail address removed) "pwd"]

%x[c:\\Program Files (x86)\\PuTTY\\plink -i
"C:\\Users\\arihan.sinha\\.ssh\\authorized_key.ppk"
(e-mail address removed) "cd Library"]

puts %x[c:\\Program Files (x86)\\PuTTY\\plink -i
"C:\\Users\\arihan.sinha\\.ssh\\authorized_key.ppk"
(e-mail address removed) "pwd"]

%x[c:\\Program Files (x86)\\PuTTY\\plink -i
"C:\\Users\\arihan.sinha\\.ssh\\authorized_key.ppk"
(e-mail address removed) "cd
Library/Caches/Google/Chrome/Default/Cache"]

puts %x[c:\\Program Files (x86)\\PuTTY\\plink -i
"C:\\Users\\arihan.sinha\\.ssh\\authorized_key.ppk"
(e-mail address removed) "pwd"]

all cases its giving output as
/Users/developer
/Users/developer
/Users/developer

Can anyone please guide me If I am doing any mistakes.

Cheers
A
 
J

Jeremy Bopp

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"
(e-mail address removed) "pwd"]

%x[c:\\Program Files (x86)\\PuTTY\\plink -i
"C:\\Users\\arihan.sinha\\.ssh\\authorized_key.ppk"
(e-mail address removed) "cd Library"]

puts %x[c:\\Program Files (x86)\\PuTTY\\plink -i
"C:\\Users\\arihan.sinha\\.ssh\\authorized_key.ppk"
(e-mail address removed) "pwd"]

%x[c:\\Program Files (x86)\\PuTTY\\plink -i
"C:\\Users\\arihan.sinha\\.ssh\\authorized_key.ppk"
(e-mail address removed) "cd
Library/Caches/Google/Chrome/Default/Cache"]

puts %x[c:\\Program Files (x86)\\PuTTY\\plink -i
"C:\\Users\\arihan.sinha\\.ssh\\authorized_key.ppk"
(e-mail address removed) "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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top