.htaccess password protection question
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Other forums
- :
- Tech Help - Software/Hardware etc
- :
- Re: .htaccess password protection question
- « Previous
-
- 1
- 2
- Next »
Re: .htaccess password protection question
14-06-2020 11:38 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I don't know if any of this is any use to you @shermans but if you adopt the random password generation approach I suggested above you can use the following code to create your password(s).
passgen.cpp
#include <iostream>
#include <random>
constexpr static std::string_view charMap("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()`~-_=+[{]}\\|;:'\",<.>/? ");
int main(int argc, char * * argv) try {
int numIters{1} ;
if (argc == 1) { std::cout << "Usage : " << argv[0] << " N I (Where N is the size of the password & I is the optional number of passwords required.)" << std::endl ; return EXIT_FAILURE ; }
if (argc == 3) numIters = std::atoi(argv[2]) ;
const int pwdSize(std::atoi(argv[1])) ;
if (pwdSize < { std::cout << "Password length too small! Must be greater than 8" << std::endl ; return EXIT_FAILURE ; }
std::random_device rd ;
std::uniform_int_distribution< int > dist(0, charMap.size() -1) ;
for (int i{0}; i < numIters; i++) {
for (int c{0}; c < pwdSize; c++) { std::cout << charMap[dist(rd)] ; }
std::cout << std::endl ;
}
return EXIT_SUCCESS ;
} catch (std::exception const& e) {
std::cerr << "Error " << e.what() << " in " << __func__ << std::endl ;
return EXIT_FAILURE ;
}
You can compile the above using:
g++ -std=c++17 -Wall -Wpedantic -Wextra -fomit-frame-pointer -o pwg passgen.cpp
As it writes the output to std::cout your shell script can capture this allowing the password(s) generated to be used elsewhere within your script. Just remember and test the return value first to ensure its 0.
When the above is executed you'll get output similar to this:
Mook@iMac Development % ./pwg 16 10
+T_xPt,0QST8Ujri
0~{cnU!LM=h^:sEh
J7Bt+'!c8"7B+\X!
<F]7/Q1!yU?6B,zQ
T{y!29\<`AUDc;=o
h#'?vV266a=A7,T~
sF,eXop"7;Can(EX
=n#Oyx$8qJP?wafX
:gwaB9%}ppJ9(~9?
15Css`OnoK/.)lav
Generation of 10 passwords each of 16 chars in length
Re: .htaccess password protection question
14-06-2020 11:50 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thanks Mook. That is really a great help. I will certainly try it and let you know.
Re: .htaccess password protection question
14-06-2020 12:15 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
This snippet of shell script to finish it off @shermans, and please don't think I'm teaching you to suck eggs I'm just trying to help.
#!/bin/zsh
PASSWDS=$(./pwg 16)
if [ $? -eq 0 ]; then
echo -e "Password is : ${PASSWDS}"
else
echo -e "Failed to generate password!"
fi
Outputs:
Mook@iMac Development % ./gen.sh
Password is : PR4jg}B!Y]o%yY`&
Re: .htaccess password protection question
20-06-2020 9:52 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Did you make any headway with this @shermans?
Re: .htaccess password protection question
26-06-2020 1:09 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Mook
Just an update. The matter is resolved, although it is not foolproof. In Chrome, which is used on the computer in question, they have changed the settings 1. Offer to Save Passwords - OFF and 2. Auto-sign-in - OFF. Then all that matters is that we remember to EXIT properly using the drop-down list on the right. Quite simple and it works.
Of course, someone with access to the Chrome password could change those settings but it is unlikely.
So thanks to everyone who offered ideas. The simplest solutions, like this one, of course are not always obvious !
- « Previous
-
- 1
- 2
- Next »
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Other forums
- :
- Tech Help - Software/Hardware etc
- :
- Re: .htaccess password protection question