F
F
FEDKOTV2020-02-12 21:31:50
linux
FEDKOTV, 2020-02-12 21:31:50

How to download a file via the command line in Linux?

There is hosting Beget.ru You
need to download a large backup and put it on another server.
The hoster has generated a link to download a file of the form https://cp.beget.ru/backup/download/file123123123
When you open this link, if there was no authorization before, the browser redirects to the login page, otherwise it allows you to download.

On GUI machines, of course, there are no problems, but what about the servers, where do I want to actually transfer this backup?
There is a Linux server, on debian 9. I tried to download via WGET with the indication of cookies, but it did not work.

I would be grateful for any help!

Ps I ask you not to offer the option of jumping and applause, because My internet is a miserable 10 Mb/s. And if you download through the server, then over 150 mb / s!

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey Sokolov, 2020-02-12
@FEDKOTV

Try to start downloading in the browser, and in the developer tools, the Network tab in FireFox, if you right-click on the download of this file, there is an item Copy - Copy as cURL:
5e4446f6902f1091091106.png
The copied command includes all the correct headers, cookies, etc.
Don't forget to direct the output of the command to a file , otherwise an unreadable binary mess will fall on the screen.
Add a greater than sign and the name of the file where to save to the command: curl -всякие опции и ссылка > file.zip
Should work from the command line, unless the cookie is bound to the uploader's IP.

If bound to IP
В таком случае придётся сделать SSH-тоннель через сервер, и использовать его как SOCKS5 прокси для браузера, чтобы зайти и авторизоваться через нужный IP.
На маке это в терминале команда ssh -ND 5555 my_ssh_host_config_name где в файле ~/.ssh/config указан конфиг хоста:
Host my_ssh_host_config_name
    HostName 123.12.12.123
    Port 1234
    User  username
    IdentityFile ~/.ssh/id_rsa

В настройках FireFox - Proxy - указать SOCKS Host: 127.0.0.1, Port: 5555, SOCKS v5
5e444987ecf34155912416.png

R
Ronald McDonald, 2020-02-12
@Zoominger

Can't get a direct link?
Did you do it this way?

wget --user=login --password='pass' --save-cookies=cooke -U "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5" "http://xxxxxxxxxxx/"

wget --load-cookies=cooke --keep-session-cookies -U "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5" "http://xxxxxxxxxxx/download.php?id=8762&name=xxxxxxxxxxx"

I
Issue, 2020-02-12
@paulenot

wget -i file.txt

A
Alexey Dmitriev, 2020-02-13
@SignFinder

via console browser links\elinks

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question