Announcement: Upgrade to macOS Mojave

With features like Dark Mode, Stacks, and four new built-in apps, macOS Mojave helps you get more out of every click. 
Find out how to upgrade to macOS Mojave > https://support.apple.com/macos/mojave

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Question:

Question: How to use SSH via terminal to upload DB?

My hosting server won't take a file larger than 50mb so they turned on SSH for me and told me to upload it that way.


I read that I can do SSH via the MacOS terminal, but can't make heads or tails of the directions.


I did manage to get in, but then could not figure out what to do next so it timed out.


I am trying to upload data into an existing database.... stuff I cannot lose in this move.


Can someone please give me some clear directions?


Thanks!

MacBook Pro with Retina display, OS X Mountain Lion (10.8.5)

Posted on

Reply

Page content loaded

Nov 12, 2017 4:57 PM in response to MacLady In response to MacLady

Use the 'scp' command (Secure CoPy, which is part of the ssh package)

Or use 'sftp' (Secure FTP, which is also part of the ssh package)

If the hosting company is allowing ssh, then they automatically accept scp and sftp


The easy way, would be to get CyberDuck and use that to sftp the file(s) to your hosting service

<https://cyberduck.io/?l=en>


If you want to try from the terminal, then

scp -rp /path/to/the/file username@hosting.system.address:

That will drop the file into your account's default home directory. If you need it to go somewhere else, then

scp -rp /path/to/the/file username@hosting.system.address:subdir/subdir/subdir

which will put the file into some subdirectory (you provided the name(s)) relative to your account's default home directory. If you need an explicit path, then

scp -rp /path/to/the/file username@hosting.system.address:/full/path/to/destination/directory

The nice thing about the scp command is that it is easier to script so you have a canned command with all the necessary information already filled out and can re-use it.


But sftp from the command line is a bit more interactive (CyberDuck would be easier of course)

sftp username@hosting.system.address

help

pwd

ls

cd path/where/you/want/to/put/the/file

ls

put /path/of/file/to/copy

Where help gives a brief summary of sftp commands (more of a reminder)

Where pwd is Print Working Directory

Where ls is lowercase Ls for list contents of the current working directory

Where cd is change working directory

Where put is how to tell sftp to upload that file

Nov 12, 2017 4:57 PM

Reply Helpful

Nov 12, 2017 5:09 PM in response to MacLady In response to MacLady

Using ssh is just giving your a remote terminal prompt on the hosted system where you can enter Unix command that run on the remote hosted system. The ssh command in and of itself does not transfer files, but as I was saying, when you have ssh, you get scp and sftp as part of the ssh package.


So I suggest you either use

sftp acctname@serverxx.domain.com


-OR- plug acctname@serverxx.domain.com into CyberDuck so you are using a GUI interface

Nov 12, 2017 5:09 PM

Reply Helpful
User profile for user: MacLady

Question: How to use SSH via terminal to upload DB?