I am trying to back up one of my sites that is password protected using wget. I can't seem to format the command correctly because I keep getting 401 errors:
wget http://dev.example.com/"Login?mode=login
> &user-username=TYPEUSERNAMEHERE&user-password=TYPEPASSWORDHERE"
Can anyone tell me what I am doing wrong here? What is the correct way to download an entire directory that is password protected using wget? Thanks!
Wait I got it:
wget -r --http-user=USERNAME --http-passwd='PASSWORD'
If the password protection is by htaccess you have to form your url like
http://USERNAME:PASSWORD#Domain.
Related
i will explain you my problem...
Im explain...I want to download all a TOR website with a wget.
but the problem is when i go to the website i have a pop up tell me:
enter username: USER / password: PASSWORD
so i type the user and the password and now i can see the login page.
But on the index i need to enter my Username and my Password of my account. And after that, its done and im in.
Now, I want to wget the website so ive used:
torsocks wget --user=USER --password=PASSWORD (for the first authentification)--keep-session-cookies --save-cookies cookies.txt --post-data 'user=myusername&password=mypassword'(for login into the website)-r http://website.onion/
But when i start the command:
torsocks wget --user=USER --password=PASSWORD --keep-session-cookies --save-cookies cookies.txt --post-data user=myusername&password=mypassword' -r http://website.onion/
I've a error 403 : Forbidden.
i hope ive been clear and you've understand my problem, and find how can i use wget on onion website using 2 authentification, one when i go to the website(probably for verify if im human), and the second for login into my account and access to the website.
If anyone have an idea, or another method than wget he's welcome,
Thanks.
I try to fetch some data from a Microsoft Dynamics Nav WebService.
This service uses the NTML authentication.
If I open the webservice url in a browser and use the given credentials everything works fine.
For setting up the environment for the WebService Client, I used the command line to check whether everything is working fine, I was, at a specific point, unable to authenticate.
Thats the command I am using:
curl --ntlm -u "DOMAIN\USERNAME" -k -v "http://hostname:port/instance/Odata/Company('CompanyName')/Customer"
The command will prompt for the password.
I copy in the password and everything is doing fine.
But when I use this command, with the password already included, it stops working and the authentication fails:
curl --ntlm -u "DOMAIN\USERNAME:PASSWORD" -k -v "http://hostname:port/instance/Odata/Company('CompanyName')/Customer"
The password contains some special chars, so I tried to use the percent encoding, which had no effect at all.
It is very difficult to research this kind of issue. Searching for curl + ntlm authentication issues provides a lot of results, but nothing is related to this specific kind of issue.
Does anyone of you guys already had experience with this kind of issue?
I had a problem with authentication because of cookies. I solved this containing cookies in txt file and using exactly this file through all requests. For example, after login request I saved this cookies:
curl -X POST -u username:password https://mysite/login -c cookies.txt
And with next request I used this file like this:
curl -X POST -u username:password https://mysite/link -b cookies.txt
This solution worked for me, I don't know if your problem is similar, but, I think, you may try this.
I was struggling with similar issue for a long time and finally I found this curl bug report #1253 NTLM authentication fails when password contains special characters (british pound symbol £) .
NTLM authentication in cURL supports only ASCII characters in passwords! This is still the case in version 7.50.1 on Ubuntu but I tested this on many different distributions and it is always the same. This bug also will break curl_init() in PHP (tested on PHP7). The only way to solve that is to avoid non ASCII characters in NTLM authentication passwords.
If you are using Python then you are lucky. Apparently Python developers rewrote cURL implementation and it works with non ASCII characters if you use HttpNtlmAuth package.
Try with nltm flag.
Something like this:
curl -v --proxy-nltm -u 'username:password' youproxy.com:8080 someURL
from > curl --help
-x, --proxy [PROTOCOL://]HOST[:PORT] Use proxy on given port
--proxy-anyauth Pick "any" proxy authentication method (H)
--proxy-basic Use Basic authentication on the proxy (H)
--proxy-digest Use Digest authentication on the proxy (H)
--proxy-negotiate Use Negotiate authentication on the proxy (H)
--proxy-ntlm Use NTLM authentication on the proxy (H)
I'm trying to connect to a server via plink. However, I'm getting the following error:
C:\>plink -ssh -pw password root#server-name
Using username "root".
Access denied
My sshd_config file contains PermitRootLogin yes, even though that's the default value, just to be sure. Is there some other configuration I need to set to allow this type of connection?
Please post or check contents of the log probably found at /var/log/auth.log.
Another question would be if you have a password added for your root account?
Otherwise you can try and set this using sudo passwd root.
My password contained special characters (!##$%^). I needed to add double-quotes around them to get it to not complain. Silly me!
I am trying to make a php script that runs on the terminal that would connect to a remote server by ssh and retrieve a file. this is my code so far
#!/usr/bin/php -q
<?php
$cwd = dirname(__FILE__).'/';
$filename = 'retrive-this.file';
$host = 'hostip';
$connection = ssh2_connect($host, 22, array('hostkey'=>'ssh-rsa'));
$methods = ssh2_auth_pubkey_file($connection, 'remoteuser',
$cwd.'ssh/id_rsa.pub',
$cwd.'ssh/id_rsa', "it's an inception");
var_dump($methods);
//ssh2_scp_recv($connection, "/remote/server/path/to/$filename", $cwd.$filename);
?>
for now I am having problems with the ssh2_auth_pubkey_file() function, when I run the script it returns this:
PHP Warning: ssh2_auth_pubkey_file(): Authentication failed for remoteuser using public key in /home/tonyl/Projects/get-file-ssh.php on line 10
bool(false)
The key files have permission -rw-r--r-- (644). Also the public key is already added to the remoteuser's authorized keys. I am able to ssh using the ssh command as normal, so I don't think it is a ssh authorization problem, but who knows. I am new to ssh and the ssh2 php library.
I can connect using ssh2_auth_password() if I enable it in the remote sshd_config file, but I don't want to do that since it decreases security tranfer.
Any ideas of what I can do.
This is a known bug in php: password protected private key cannot be used on certain combinaisons.
See: https://bugs.php.net/bug.php?id=58573
ssh2_auth_pubkey_file() is broken when the public key file is protected with a password AND libssh2 is compiled with libgcrypt, which is what debian/ubuntu and probably others do. I'm working on a solution for this bug, but if you need this working rebuild libssh2 yourself with OpenSSL.
A workaround may be to store the private key unencrypted.
To decrypt the key:
openssl rsa -in id_rsa -out id_rsaNOPASSWORD
and then use the file id_rsaNOPASSWORD without supplying the fifth parameter 'passphrase'.
It works, but you'll have to be careful with your decrypted key file. Anyway, the level of security is not really terribly affected, because even with an encrypted key, you would still need to pass the passphrase unencrypted to the ssh2_auth_pubkey_file function ...
Hope it helps.
this looks like the error right here. FILE is a filepath isn't it? so it looks something like /somedir/somefile.php and all you have done is add a / on the end of .php so I don't think this is really valid. see http://www.php.net/manual/en/language.constants.predefined.php
$cwd = dirname(__FILE__).'/';
also, other people have been having problems with ssh2_auth_pubkey_file
returning false under all conditions. you may want to submit a bug report. I was hoping to use this function. I don't know how to use it because I have no idea how to supply a private key.
I think the code you want is
if (!defined('__DIR__')) {
$iPos = strrpos(__FILE__, "/");
define("__DIR__", substr(__FILE__, 0, $iPos) . "/");
}
$cwd=__DIR__ . '/';
and keep in mind that when it comes to the remote directory, you should be using ssh2_sftp_realpath().
dirname() has been reported to be unreliable.
I have been using this function for around 3 years and for some reason a new server that I was configuring didn´t work. I was about to jump by the balcony when I found this :
ssh-keygen -m PEM -t rsa -b 4096
using the link #megar answered years ago.
Hope it helps someone else, this was hard!
I've tried both
wget --user=myuser --password=mypassword myfile
and
wget --ftp-user=myuser --ftp-password=mypassword myfile
but I keep getting the error
HTTP request sent, awaiting response... 401 Authorization Required
Authorization failed.
I know the file is there, and I know the username/password are correct - I can ftp in with no problem. Any thoughts on what's going on here? How do I even tell if wget is paying attention to the username/password that I'm giving it? (The error is the same if I simply don't provide that info.)
try wget --http-user=username --http-password=password http://....
Are you using an "ftp://" URL? From the error message it appears that you're making a request for an "http://" URL.
One more comment:
Setting --user and --password sets the user/pw for both ftp and http requests, so that's more general.
In my case, nothing worked, except using --ask-password
I was using a https URL.
it might be useful to add that if you need to add a domain name before that the backslash must be escaped i.e. "\" is preceded with another "\" e.g. "domain\\username" similarly if the password has any chars that requires escaping (i supposed, havn't tested it).
wget --http-user=domain\\\username --http-password=password http://...