4 Replies Latest reply: Dec 22, 2010 2:10 PM by BobHarris
appleaka Level 1 Level 1 (20 points)
Is there a way at school to ssh into mu computer using command prompt, copy the file i need to the desktop of the pc i am using? Is there any way to do that. I can do that GUI from a PC laptop to mac in the same house using login credinteals, but this is remote, any suggestions?

iMac Late 2009, Mac OS X (10.6.4), iMac, iPod Touch 2nd Generation w/ OS 3.1.3, iPod Nano 3rd Generation
  • Nils C. Anderson Level 4 Level 4 (3,495 points)
    The following command will copy a file from a remote host
    and put it in you current working directory.


    scp <user>@<remote hostname>:/path/to/file .


    don't leave off the dot, at the end of the command line above.

    Message was edited by: Nils C. Anderson
  • BobHarris Level 6 Level 6 (15,220 points)
    The GUI from a PC to your Mac would be TeamViewer.com

    TeamViewer.com is free for personal use, and has both Mac and PC versions. The connections are secure, and TeamViewer.com includes file transfer capabilities.

    For pay, you can do file transfer using LogMeIn.com. It has a free option for screen sharing, but file transfer requires a for pay option.

    The ssh route. More work, but it can be effective.

    With respect to ssh on the PC, you can use PuTTY, or a Cygwin.com environment (maybe others).

    The fun part is configuring your home router so that port 22 is forwarded to your Mac, and getting a dynamic DNS name from No-IP.com or DynDNS.org so that you can easily.

    PortForward.com has documents providing step-by-step guides on how to setup port forwarding for a huge list of routers
    <http://portforward.com/>

    Finally you will need to enable System Preferences -> Sharing -> Remote Login which allows ssh connections to your Mac.

    Now you can use scp or sftp from a PC client to transfer files to/from your Mac. There are also PC sftp clients available for secure transfers via an ssh connection (but you still need to do all the configuration work on your home router and Mac).
  • appleaka Level 1 Level 1 (20 points)
    Where will my file be saved? Also is that command for command prompt or terminal or both?
  • BobHarris Level 6 Level 6 (15,220 points)
    Where will my file be saved?

    in . (dot; aka the current working directory; which if you have not used the 'cd' command will be your home directory).

    The . is the . in the example scp command given above.
    Also is that command for command prompt or terminal or both?

    The Terminal does not have commands. The Terminal is a GUI applications that emulates a character cell terminal. Terminal's job is to give you a simulated terminal screen, take your keyboard input and pass it to the shell (which is 'bash'), and anything that is output from the pseudo serial port is then displayed on the simulated terminal screen.

    You start Applications -> Utilities -> Terminal
    Once you get a command prompt from the shell (bash)
    enter the scp command

    scp username@remote.system.address:/path/of/file/to/copy /local/destination/path/to/store/the/file

    # -OR-

    scp /local/path/to/file username@remote.system.address:/path/store/file

    However, if you can get to this stage, then you can also use a GUI based sftp utility on a PC (or a Mac).