File transfer over SSH onto linux server from hard disk on remote MAC

Sonal

New Member
Joined
May 23, 2017
Messages
20
Reaction score
1
Credits
0
Hi, I have 1.96 TB sized folder on a hard disk and I want to upload it to the server from my MAC PC using SSH. What is the quickest and effective way to do it?
 


If you are wanting to use SSH/internet to do it, you're looking at rsync (or scp - I'd choose rsync). Usage:

rsync -Paz /path/to/your/source/directory [email protected]:/path/to/destination/

Note: if your source is the directory name without a trailing /, it will transfer the directory too. If you include the trailing / for the source directory, it will transfer the contents of the directory. (rsync -Paz asdf user@IP:~ will transfer directory to /home/user/asdf, rsync -Paz asdf/ user@ip:~ will transfer everything inside of asdf into /home/user/ and not create the asdf directory)

Switches: -P = --progress and --partial, -a == --archive, -z == use compression. Depending on your file types (JPG, MP4, EXE, stuff that doesn't compress well), this might actually hurt your overall performance by 1%.
 
@Steve. Thank you for your response. I tried this option but gives below error. I assume the connection to server is not established

ssh: connect to host _IP port 22: Operation timed out
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-45/rsync/io.c(453) [sender=2.6.9]
 
"ssh: connect to host _IP port 22: Operation timed out" -- means that you're not able to connect to it via SSH on port 22. If you're running on a different port, you'd need to tweak the rsync line to something like:
Code:
rsync -Paz -e "ssh -p xxxx" /path/to/source user@IPorHostname:/path/to/dest/"
What's your command to SSH into the destination? (remove username and IP/host for security, plzkthx)
 
rsync -Paz /Path_to_Source username@IP:/Path_to_Destination
 
Try telnetting to port 22 of your server to see if it's open.. should see something like:
Code:
telnet linux.org 22
Trying 107.170.33.185...
Connected to linux.org.
Escape character is '^]'.
SSH-2.0-OpenSSH_5.3
 
@Rob: The port is Open.

telnet linux.org 22

Trying 107.170.33.185...

Connected to linux.org.

Escape character is '^]'.

SSH-2.0-OpenSSH_5.3
 
@Steve : Pardon me if the question is silly as I am really new to linux.
What is XXXX in your command. Is the port no. I am still not able to connect.
 
Yes, he's using xxxx as the port..

If your server is using the default SSH port, it's 22 and you don't have to specify it, but if it's 2222 or something, then you'd use this command, assuming you're connecting as sonal @ example.com:

Code:
rsync -Paz -e "ssh -p 2222" /path/to/source [email protected]:/path/to/dest/
 
well, replace `linux.org` with your hostname or IP address..

Rob
I can't connect to host.

telnet: connect to address IP: Operation timed out

telnet: Unable to connect to remote host
 
Ok, and your server is online currently I'm assuming :)

I'd call your host and ensure ssh is enabled and inquire which port it's operating on.. also ensure you have shell access as some hosts disable it on a user level as well.

Rob
 
rsync -Paz /Path_to_Source username@host:/Path_to_destination. It stops unexpectedly but gives error

file has vanished: "/Path_to_source/Part_2/2017-05-15-12-17-15-File110743.sgd"
rsync: readdir("/Path_to_Source"): Input/output error (5)
106703 files to consider
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-45/rsync/io.c(453) [sender=2.6.9]
 
Can you confirm that you can SSH in with the same user/pass?


Yes i can ssh with the same user. The error shows with the file/s in the folder I am trying to copy.
 
rsync: connection unexpectedly closed (8 bytes received so far) [sender]
OK, you've been able to start over SSH, but it times out. Try without the "z" as well - I've had some issues when trying to transfer a large number of files to another location timing out. And if that doesn't work, you might need to edit on the server the /etc/ssh/sshd.conf file (I think that's the location/file) and change the timeout to something larger and restart sshd.
 
So it starts building the file list and then stops and gives below error.


rsync: connection unexpectedly closed (8 bytes received so far) [sender]

rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-45/rsync/io.c(453) [sender=2.6.9]
 

Staff online


Top