Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > How to copy an application over SSH

How to copy an application over SSH
Thread Tools
Mac Enthusiast
Join Date: Jan 2001
Location: Leesburg, Virginia
Status: Offline
Reply With Quote
Dec 28, 2002, 03:33 PM
 
I am wondering how I can copy an application over an SSH connection. I tried to tar and gzip it, but it lost its resource fork.

I tried to launch a remote AppleScript that would instruct DropStuff to compress the app, but it wouldn't work, beause, presumably, I need to be logged in through the GUI to make DropStuff launch remotely. I can't do that because that machine is 1200 mi. away.

There probably is also some way to set up a file sharing connection through an SSH tunnel, but I don't have any documentation handy to try to figure that one out. It would have to be SSH, because all other ports on my router at the remote location are not open.

Any suggestion is appreciated.

Dominik Hoffmann
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Dec 28, 2002, 04:42 PM
 
hmm.. an interesting problem that took more than I expected to find a solution to.

First it appears as though DropStuff isn't scriptable. However, you can use Stuffit Deluxe to do what you need. Even then, it may need a GUI to launch, I'm not sure.

Setting up an SSH tunnel is easy enough - as long as the relevant file sharing servers are enabled/running on the remote machine. Do you know which (if any) servers are running?

Assuming that an AFP server is running (or you can enable it by editing /etc/hostconfig and restarting the server), you should be able to run:

sudo -L 548:localhost:548 <address of remote machine>

Then use the 'Connect to server...' menu in the Finder to connect to 'afp://localhost'

With luck you'll be tunnelled over to the remote machine using AFP, a file sharing protocol that understands Apple's file system, resource forks, etc.

Note, this will only work if your own machine is NOT running as an AFP server (i.e. Personal File Sharing is disabled in Sharing Preferences). If are you are running personal sharing and can't turn it off, use a different port number to connect to locally, like:

ssh -L 12345:localhost:528 <address of remote machine>

then connect to server afp://localhost:12345
Gods don't kill people - people with Gods kill people.
     
Junior Member
Join Date: Nov 2001
Status: Offline
Reply With Quote
Dec 29, 2002, 12:37 AM
 
You can access the resource fork of a file by referencing "filename/rsrc". The resource fork is not returned in a getdirentries so it doesn't show up in an "ls" but it is there.

So if you had a file called "SomeFile" you could tar it and save the resources with:

tar -cvf SomeFile.tgz SomeFile SomeFile/rsrc

untar it and it will create both the file and the resource. But you copy them both with scp which would be even easier.

- Mike
     
Mac Enthusiast
Join Date: Jan 2001
Location: Leesburg, Virginia
Status: Offline
Reply With Quote
Dec 29, 2002, 02:52 AM
 
I tried something similar to what you suggested. Except, I had to address the fact that I have a router with NAT and port forwarding from natrouter.dominik.com to 192.168.1.100 on port 22. 192.168.1.100 is the machine with AFP running and the files I want to grab. Here is what I get:

[dominikpb:~] admin% ssh -L 548:192.168.1.100:548 natrouter.dominik.com
Privileged ports can only be forwarded by root.

So I redo it with sudo

[dominikpb:~] admin% sudo ssh -L 548:192.168.1.100:548 natrouter.dominik.com
Password:
root@natrouter.dominik.com's password:
Permission denied, please try again.

But it seems like I need to provide the root password for 192.168.1.100. However, root is not enabled on that machine.

Any ideas?

Dominik Hoffmann
     
Mac Enthusiast
Join Date: Jan 2001
Location: Leesburg, Virginia
Status: Offline
Reply With Quote
Dec 29, 2002, 02:58 AM
 
P.S.: Camelot, my notion of how to involve my NAT box comes from your response to an earlier post.. -- Dominik
     
Mac Enthusiast
Join Date: Jan 2001
Location: Leesburg, Virginia
Status: Offline
Reply With Quote
Dec 29, 2002, 03:21 AM
 
I found the answer at the AFP548 site. I followed those instructions exactly. I don't know, why it didn't work earlier, but now it does.

As for the root@natrouter.dominik.com problem, that simply comes from having prefixed the ssh command with sudo. That makes ssh think that I want to use the same user ID on the remote system as I use locally, which, with sudo, is root.

Dominik
     
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Dec 29, 2002, 11:02 AM
 
You could also try to make a disk image with hdiutil ...
[Wevah setPostCount:[Wevah postCount] + 1];
     
Fresh-Faced Recruit
Join Date: Jan 2003
Location: GekoLand
Status: Offline
Reply With Quote
Jan 1, 2003, 06:30 PM
 
Originally posted by DominikHoffmann:
I am wondering how I can copy an application over an SSH connection. I tried to tar and gzip it, but it lost its resource fork.
i see someone else already answered about this


There probably is also some way to set up a file sharing connection through an SSH tunnel, but I don't have any documentation handy to try to figure that one out. It would have to be SSH, because all other ports on my router at the remote location are not open.
i think the easiest thing is scp, it is fast and secure...
malbicho --> +mal +bichos
www.ppcnerds.org :)
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Jan 2, 2003, 04:43 AM
 
Originally posted by DominikHoffmann:
[dominikpb:~] admin% sudo ssh -L 548:192.168.1.100:548 natrouter.dominik.com
Password:
root@natrouter.dominik.com's password:
Permission denied, please try again.

But it seems like I need to provide the root password for 192.168.1.100. However, root is not enabled on that machine.
so your fix is:

sudo ssh -L 548:192.168.1.100:548 dominikpb@natrouter.dominik.com

i.e. you log into the remote machine as user dominikpb, even though you invoked the command as root.
Gods don't kill people - people with Gods kill people.
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Jan 2, 2003, 04:46 AM
 
Originally posted by malbicho:
i think the easiest thing is scp, it is fast and secure...
except scp, as a unix util, doesn't see the resource fork.
Gods don't kill people - people with Gods kill people.
     
Grizzled Veteran
Join Date: Sep 2000
Location: Adelaide, Australia
Status: Offline
Reply With Quote
Jan 2, 2003, 06:48 AM
 
Originally posted by Camelot:




ssh -L 12345:localhost:528 <address of remote machine>

then connect to server afp://localhost:12345
Ah thanks Camelot this solves a problem for me.

Before 10.2 I had this working by invoking

ssh -L 12345:remote.machine:548 remote.machine

and then after 10.2 it wouldn't work - connect to
server afp://localhost:12345 just gave a mysterious error.
I just tried your version

ssh -L 12345:localhost:548 remote.machine

and connect to server afp://localhost:12345 does work
and tunnels the afp connection to remote.machine.

Do you understand the difference between these two command - ie
why one works and the other doesn't. It seems that in both cases I
am telling remote.machine to connect to itself.

Thanks - Michael
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Jan 2, 2003, 10:26 AM
 
Originally posted by Camelot:
except scp, as a unix util, doesn't see the resource fork.
pah, who needs resource forks?
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:47 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2