Then, use this command: $ scp -r means that the directory along with all its contents is going to be processed recursively. Put all the files on the remote machine that you want to copy over to your local computer in a separate directory. Make sure that it's up and running (the green light thing shows that it is): $ systemctl status sshd So, install it first: $ sudo apt-get install openssh-server -y Since you have already successfully logged in to another computer on your network, you can simply copy your files to your local machine from there, but you're going to need to get an ssh deamon running on your local machine. ssh is only used for remote login access. To move files from computer to computer over a network, you use the scp utility ( scp stands for secure copy). You can set cronjob or bash script which handle this task. Mount this folder on machine A and move these files where you want. You can create dedicated folder into machine B and copy your files into that folder. While you are SSH connected from machine A to machine B, and you are not able to establish an SSH connection from B to A. Then use cp, rsync or mc to copy your files. You can use one of the above approaches to mount a folder from A on B. While you are ssh connected from machine A to machine B, and you are able to establish an ssh connection from B to A. Mount a remote path, when you have properly configured ~/.ssh/config file: sshfs hostname:/remote/path ~/sshfs-mount-point Mount a remote path, when you using custom ssh settings: sshfs -o IdentityFile=/path/to/id_rsa,port=2222 ~/sshfs-mount-point Mount a remote path, when you using the default ssh settings: sshfs ~/sshfs-mount-point There is no fuse user group.Ĭreate an appropriate mounting directory, for example: mkdir ~/sshfs-mount-point Unlike this guide I haven't done anything other on my Ubuntu 16.04. The client side mounting the filesystem is as easy as logging into the on the server side there's nothing to do. Since most SSH servers already support this protocol it is ![]() Sshfs is a filesystem client based on the SSH File Transfer Remote computer the SFTP subsystem of SSH is used. Over SSH just as if they were local files on his/her computer. User can seamlessly interact with remote files being securely served The practical effect of this is that the end Mounted, the implementation makes use of the FUSE (Filesystem in Operating on files on a remote computer using just a secure shell SSHFS (Secure SHell FileSystem) is a file system for Linux (and other operating systems with a FUSE implementation) capable of If you need an easy way to browse the file system of a remote machine and copy certain files to the local machine (and vice versa) you can use SSHFS. Or rather than trying to do it from ComputerB, you can just run the scp command from ComputerA. Scenario 3: perform the file copy from ComputerA Thus, by tunneling backwards over the existing ssh connection, it doesn't matter that ComputerA is behind an NAT firewall. All connections to port 2222 on ComputerB get forwarded to port 22 (default ssh port) on ComputerA. We are indeed telling scp to pass the file back to ComputerB, but to port 2222. Now from ComputerB, you can issue the scp command in the following manner to copy files from ComputerB -> ComputerA where ComputerAUser is your username on ComputerA: scp -P 2222 /path/to/file/on/ComputerB happening here? It looks like we are simply telling ComputerB to send the file back to itself because we're passing localhost instead of ComputerA. We'll use this port to reverse-tunnel back to ComputerA from ComputerB. ssh -R 2222:localhost:22 where ComputerBUser is the username for the account on ComputerB being authenticated and 2222 is a free port on ComputerB. When establishing the ssh connection ComputerA -> ComputerB, do so with the -R option in the following manner. In this case, you can configure your ssh tunnel from ComputerA -> ComputerB such it can tunnel reverse connections as well. However, you may not always have access to make these kinds of changes. In this scenario, you would typically need to configure port-forwarding in the NAT firewall. To use this solution, run from ComputerB: scp /path/to/file/on/ComputerB 2: If ComputerA is behind an NAT firewall It requires you to have an ssh server (and client) installed on both ends (computerA and computerB). This is a swift and easy solution, combining scp and ssh (scp performs a secure copy using ssh protocols). Scenario 1: If ComputerA is not behind an NAT firewall ![]() ComputerB is a remote machine that you can access via ssh. Say you have two computers, ComputerA and ComputerB. I'm posting a separate solution altogether to account for the situation where it may be difficult because of network structure (think NAT firewall) to simply ssh back into the local system. Nullmeta's answer is completely valid, and perhaps nullmeta will edit to provide the clarification you're looking for.
0 Comments
Leave a Reply. |