LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Copying files to local computer whilst in ssh tunnel (http://www.linuxquestions.org/questions/linux-newbie-8/copying-files-to-local-computer-whilst-in-ssh-tunnel-490103/)

Maverick1182 10-06-2006 04:47 PM

Copying files to local computer whilst in ssh tunnel
 
Hi there, after the inital excitement of connecting to my college network drive from home via the console I was wondering how I can pull files (or push them onto) my network drive? The "cp" command wont work because there's no way of specifying the local of your home computer as the desitination as it is all done relative to the college network drive. I have tried

ssh target_address cat remotefile > localfile


and it works brilliantly but the only problem is that it assumes you know the exact location of the file before you start. is there anyway I can connect via ssh and then browse round and then pull the files pack to my local machine whilst in the ssh tunnel (and vice versa with push) ?

pljvaldez 10-06-2006 04:51 PM

Look at scp.

haertig 10-06-2006 05:30 PM

sshfs is convenient if you're be copying a bunch of files from differing locations. You effectively "mount" the remote computer (in it's entirity or just a part of it) to a mountpoint on your local computer. All over a single ssh tunnel that needs nothing special on the remote server.

Mounting goes like this:
Code:

$ sshfs remote_userid@remote_host.domain.com:/ /mnt/local_mountpoint
And unmounting, like this:
Code:

fusermount -u /mnt/local_mountpoint
After mounting, the remote system appears just like a local resource, so you use standard commands like "cp" to do your copying. You are of course limited by file permissions enforced by the remote. You can't copy a file if the remote denies you reading it in the first place.

The cool thing about this is,the remote server only has to have a normal ssh server installed. Nothing else. Locally, you have to install sshfs though.

Maverick1182 10-06-2006 07:21 PM

The problem with scp seems to be the same as with ssh (from what i've read) it still needs inputs as you execute the command to create the tunnel. The second option of a mount is more or less what I think i'm after. Sorry if I explained it badly. Is there a maximum number of connections i can have using ssh to the same server? eg. can i mount the home directory and still move around in the directory using a ssh command and run applications? or is it one tunnel per server?

Maverick1182 10-07-2006 02:29 PM

haertig , i've got exactly what i wanted which was to get sshfs running. it connects fine with my remote computer at university. I've even made a lil script to connect it and open konqueror to the mount file. THe problem is that konqueror doesnt seem to be able to locate it. I can see it as root and can play around with the files but as a normal user, I cant seem to see it in my session. I've tried to chmod 777 the /mnt/IC folder which sshfs mounts to. The permissions seem to have changed as seen below:
heaven mark # ls -l /mnt
total 60
drwxrwxrwx 1 58382 6957 4096 Oct 6 20:53 IC
drwx------ 2 root root 4096 Feb 14 2006 cdrom
drwxr-xr-x 2 root root 4096 Jul 27 08:53 cdrw
drwxr-xr-x 2 root root 4096 Jul 27 08:53 dvd
drwxrwxrwx 23 root root 4096 Oct 7 16:26 fatty
drwx------ 2 root root 4096 Feb 14 2006 floppy
drwxr-xr-x 2 root root 4096 Jul 26 22:24 opt
drwxr-xr-x 2 root root 4096 Aug 12 18:39 tempstuff
drwxr-xr-x 2 root root 4096 Jul 26 22:24 usr
drwxr-xr-x 2 root root 4096 Jul 26 22:24 var
dr-x------ 1 root root 8192 Oct 7 15:21 winc
dr-xr-xr-x 1 root root 12288 Sep 27 21:46 wind


Any ideas? I'm so close! lol


EDIT: i found a fast way to use ssh in konqueror , simply type use fish

so its "fish://username@computer_name-or-host" in the address bar, it will ask for a password and then log you in, hope this helps people. like me. heres a good link

http://www.linux.org/lessons/short/fish/x30.html


All times are GMT -5. The time now is 03:36 PM.