How would I construct a terminal command to download a folder with wget from a Media Temple (gs) server? - ftp

I'm trying to download a folder using wget on the Terminal (I'm usin a Mac if that matters) because my ftp client sucks and keeps timing out. It doesn't stay connected for long. So I was wondering if I could use wget to connect via ftp protocol to the server to download the directory in question. I have searched around in the internet for this and have attempted to write the command but it keeps failing. So assuming the following:
ftp username is: serveradmin#mydomain.ca
ftp host is: ftp.s12345.gridserver.com
ftp password is: somepassword
I have tried to write the command in the following ways:
wget -r ftp://serveradmin#mydomain.ca:somepassword#s12345.gridserver.com/path/to/desired/folder/
wget -r ftp://serveradmin:somepassword#s12345.gridserver.com/path/to/desired/folder/
When I try the first way I get this error:
Bad port number.
When I try the second way I get a little further but I get this error:
Resolving s12345.gridserver.com... 71.46.226.79
Connecting to s12345.gridserver.com|71.46.226.79|:21... connected.
Logging in as serveradmin ...
Login incorrect.
What could I be doing wrong?

Use scp on the Mac instead, it will probably work much nicer.
scp -r user#mediatemplehost.net:/folder/path /local/path

Related

How do I pass a full sftp url to the sftp command?

I have a website that provides sftp links in the format sftp://user#host.com/path/to/file.zip. To get this working via command line, I need to copy the link, and either run sftp user#host and then paste the path into the resulting shell:
$ > get /path/to/file.zip
Or I need to manipulate the url into something like sftp user#host.com:/path/to/file/zip
Today I saw someone just run sftp sftp://user#host.com/path/to/file.zip and it worked just fine. When I do this it seems that sftp interprets the file path as part of the host and says
ssh: Could not resolve hostname host.com/path/to/file.zip
How can I get it working such that I can just run this? sftp sftp://user#host.com/path/to/file.zip
The URL syntax is supported by OpenSSH 7.7 and newer only.
As OpenSSH 7.7 is relatively new (2018-04-02), it is quite probable that you are using an older version.
Se also a related question Using sftp like scp.

Wget - How do I download some files from ftp server?

I am trying to download some files from a directory in ftp server. I would like to use "wget" command, but I can't get them.
ftp server URL: ftp://192.168.0.10
ftp user name: GL840
ftp password: no password
folder name in ftp: SD1/181004/
I am using the following command to download all files in the folder SD1/181004 in ftp server.
command is "wget -r -nd ftp://GL840:#192.168.0.10/SD1/181004/ -P /root/wang/powerdata/"
However, the following message is displayed and files are not downloaded.
Could you please tell me how to modify my command to download files?
I have tried accessing file on ftp server. Usually I follow the following commands and this works for me. You can give a try with this command
wget --user='GL840' --password='' ftp://192.168.0.10/SD1/181004/

SCP file from ssh session to localhost

I have a headless file server on which I store and manage downloads and media, but occasionally I have to transfer small files back to my computer (Mac, using bash shell). The problem is that some files have more user-friendly names and commonly have spaces in them, and they are buried in the file directory hierarchy I have set up on my server.
When I'm using scp from my local machine, I don't have tab completion, so I have to manually type out the entire path and name with spaces escaped. When I ssh into the server first, the command:
scp /home/me/files/file\ name\ with\ spaces.png Me#localhost:/Users/Me/MyDirectory
fails with the error "Permission denied, please try again" even though I'm entering my local machine user password properly.
I've learned a little bit of sftp since I've been told that may be a better tool for file transfer. However, the utility seems outdated and I still don't have tab completion after establishing a connection to the server (on my Terminal when pressing Tab I just get a tab character).
My question is this: what can I do to allow tab completion while using scp from my Mac? Or am I using incorrect syntax for scp while in an ssh session, and is there something in that command I should fix? Or, is there a (better? newer?) tool other than sftp that would offer tab completion on a server?
Finally, if none of these problems have simple solutions, is there some package I could install (e.g. a completion package from Homebrew or the like) that would facilitate better tab-completion with any of these commands?
Looks to me like this is some incorrect scping.
This is the format of the command
scp ./localFile.txt remoteUser#remoteHost:/remoteFile.txt
You were so close, but you have localhost set where you should have your remoteHost.
localhost is the name that resolves to the machine that you are currently on - so in your workflow, you are sshing to a machine, and then trying to scp that file to the same machine you are already sshd into.
What you need to do, is figure out the IP address, or the physical host name of the computer that you are trying to connect to, and use that instead.
scp ./localFile.txt remoteUser#192.168.1.100:/remoteFile.txt
# where 192.168.1.100 would be the IP of your Mac
I am assuming the reason you were getting permission denied, was because you were using your the login credentials for you mac, but unknowingly trying to login again to your headless machine.

wget does not log into ftp server without sudo

When I do:
sudo wget ${FTPpath}* -nc
It gets the files without a problem, but entering a password is awkward for automation. Also just seems like bad practice.
When I leave out the sudo, it does not connect to the ftp server:
--2015-12-09 11:02:17-- ftp://dmanalytics:*password*#10.10.23.32/dmanalytics/download/*
=> ‘.listing’
Connecting to 197.80.203.9:3128... connected.
Logging in as dmanalytics ...
And then it just sits there.
I am working via a proxy, but I don't think its that. Above it says connected, but also I tried:
wget ${FTPpath}* -e use_proxy=yes -e http_proxy=197.80.203.9:3128 -nc
without any success. Any ideas what is causing my failure to log into the ftp server, and how I can fix my wget command so that I don't have to use sudo?

Copy folder from an http source to a local directory

I am trying to copy a folder from an http source using the following statement:
FileUtils.cp_r 'http://else.repository.labs/static/lit/MDMInternalTools/', 'c:\Users\Public\Desktop\'
However I get this error:
EINVAL: Invalid argument - https://else.repository.labs/static/lit/MDMInternalTools/
If that's a folder on a server that you have access to via ssh, then you can use scp to copy individual files, or a folder with all subfolders/files, using the -r option. The command will be something like
scp -r username#http://else.repository.labs:/path/to/rails/public/static/lit/MDMInternalTools c:\Users\Public\Desktop
This is assuming you can use scp. It looks like you're in windows, you'll need a decent command-line shell where you can install ssh.
https://en.wikipedia.org/wiki/Secure_copy
You can check if the server supports webdav, have an ftp or an ssh access.
Otherwise your only choice could be to use wget to get a local mirror:
wget -mk http://else.repository.labs/static/lit/MDMInternalTools/

Resources