In Esxi Security.PasswordQualityControl what does '-' and '+' mean - esxi

Change only through host advanced option "Security.PasswordQualityControl"
-password requisite /lib ~ /pam_passefqc.so retry=3 min = disabled,disabled,disabled,15,15 passphrase=0
+password requisite /lib ~ /pam_passefqc.so retry=3 min = disabled,8,8,8,8 passphrase=0
When you get those lines in your configuration file, what is the meaning of the below line. Why you should have those two lines at the same time. What do they function.

Related

Using Pest.rs, how can I avoid 'peek was called on empty stack' if the PUSH is optional?

Pest.rs has the ability to push and peek onto a stack. This is useful when a delimiter is given by the user like custom-quoting found in Perl, and PostgreSQL (double dollar syntax). How can I do this if the item may not be on the stack. For example, the Exim config file states,
It is also possible to use newline and other control characters (those with code values less than 32, plus DEL) as separators in lists. Such separators must be provided literally at the time the list is processed. For options that are string-expanded, you can write the separator using a normal escape sequence. This will be processed by the expander before the string is interpreted as a list. For example, if a newline-separated list of domains is generated by a lookup, you can process it directly by a line such as this:
domains = <\n ${lookup mysql{.....}}
You can see here the token <\n which overrides the default separator of : is optional. You can see here that the syntax is essentially,
list_sep = ${ "<" ~ (!WHITE_SPACE ~ ANY) }
list = {
list_type
~ key
~ "="
~ PUSH(list_sep)?
~ !(PEEK ~ ANY)+
~ (PEEK ~ !(PEEK ~ ANY))*
}
But when I run that I get,
peek was called on empty stack
Is there anyway to provide for this operation with PEG such that the list is presented to the user as a string, but as an actual list of element tokens?
One method I've started doing is making sure the PUSH always happens. It even seems like an opitional PUSH should be a compiler error,
Rather than
~ PUSH(list_sep)?
Do this,
~ PUSH(list_sep?)

How to escape ( parenthesis in stata - invalid '(' error r(196)

I have to replicate a do file of a colleague who used a macro for his file names. The problem is that the pathname contains a parenthesis, which causes problems:
*setting directory
cd "D:/Dropbox (Center for Child Well-being and Development)/2020/Playground"
*setup
sysuse auto
save "/Dropbox (Center for Child Well-being and Development)/example", replace
*problem
global path "/Dropbox (Center for Child Well-being and Development)"
local file "/example.dta"
global data "$path`file'""
disp "$data"
use $data
I get the following output
. disp "$data"
/Dropbox (Center for Child Well-being and Development)/example.dta
. use $data
invalid '('
r(198);
I know that calling the macro within quotations as use "$data" would do the job, but as it is not my do file I would like to try to avoid changing every occurrence where the macro is used.
I tried to escape the parenthesis with \( and add various numbers of quotations at any position I could imagine while constructing the global. Also I tried to add escaped quotations \" which did work neither.

Display X characters after matched word

I'd like to display the file and version number for different services. For example there might be a line in the text file that says nginx 1.13.0. I'd like to be able to search every single instance of nginx [0-9].[0-9].[0-9] and have it displayed with the version number and file name / line.
I've already tried this command which works well for displaying the matched files:
grep -lrEH "nginx [0-9].[0-9].[0-9]"
You are close, missing that it might be more than one digit +. You should also escape the ., so it mean only . and not any character.
Try:
grep -EHro "nginx [0-9]+\.[0-9]+\.[0-9]+"

Match Lines From Two Lists With Wildcards In One List

I have two lists, one of which contains wildcards (in this case represented by *). I would like to compare the two lists and create an output of those that match, with each wildcard * representing a single character.
For example:
File 1
123456|Jane|Johnson|Pharmacist|janejohnson#gmail.com
09876579|Frank|Roberts|Butcher|frankie1#hotmail.com
092362936|Joe|Jordan|Joiner|joe#joesjoinery.com
928|Bob|Horton|Farmer|bhorton#farmernews.co.uk
File 2
1***6|Jane|Johnson|Pharmacist|janejohnson#gmail.com
09876579|Frank|Roberts|Butcher|f**1#hotmail.com
092362936|Joe|Jordan|J*****|joe#joesjoinery.com
928|Bob|Horton|Farmer|b*****n#f*********.co.uk
Output
092362936|Joe|Jordan|Joiner|joe#joesjoinery.com
928|Bob|Horton|Farmer|bhorton#farmernews.co.uk
Explanation
The first two lines are not considered matches because the number of *s is not equal to the number of characters shown in the first file. The latter two are, so they are added to output.
I have tried to reason out ways to do this in AWK and using Join, but I don't know any way to even start trying to achieve this. Any help would be greatly appreciated.
$ cat tst.awk
NR==FNR {
file1[$0]
next
}
{
# Make every non-* char literal (see https://stackoverflow.com/a/29613573/1745001):
gsub(/[^^*]/,"[&]") # Convert every char X to [X] except ^ and *
gsub(/\^/,"\\^") # Convert every ^ to \^
# Convert every * to .:
gsub(/\*/,".")
# Add line start/end anchors
$0 = "^" $0 "$"
# See if the current file2 line matches any line from file1
# and if so print that line from file1:
for ( line in file1 ) {
if ( line ~ $0 ) {
print line
}
}
}
$ awk -f tst.awk file1 file2
092362936|Joe|Jordan|Joiner|joe#joesjoinery.com
928|Bob|Horton|Farmer|bhorton#farmernews.co.uk
sed 's/\./\\./g; s/\*/./g' file2 | xargs -I{} grep {} file1
Explanation:
I'd take advantage of regular expression matching. To do that, we need to turn every asterisk * into a dot ., which represents any character in regular expressions. As a side effect of enabling regular expressions, we need to escape all special characters, particularly the ., in order for them to be taken literally. In a regular expression, we need to use \. to represent a dot (as opposed to any character).
The first step is perform these substitutions with sed, the second is passing every resulting line as a search pattern to grep, and search file1 for that pattern. The glue that allows to do this is xargs, where a {} is a placeholder representing a single line from the results of the sed command.
Note:
This is not a general, safe solution you can simply copy and paste: you should watch out for any characters, in your file containing the asterisks, that are considered special in grep regular expressions.
Update:
jhnc extends the escaping to any of the following characters: .\^$[], thus accounting for almost all sorts of email addresses. He/she then avoids the use of xargs by employing -f - to pass the results of sed as search expressions to grep:
sed 's/[.\\^$[]/\\&/g; s/[*]/./g' file2 | grep -f - file1
This solution is both more general and more efficient, see comment below.

What is the best way to use tr and grep on a folder?

I'm trying to search through all files in a folder for the following string
<cert>
</cert>
However, I have to remove line returns.
The following code works on one file but how can I pipe an entire folder through the tr and grep? The -l option is to only print the filename and not the whole file.
tr -d '\n' < test | grep -l '<cert></cert>'
The tr/grep approach requires grep to process the whole file as one line. While GNU grep can handle long lines, many others cannot. Also, if the file is large, memory may be taxed.
The following avoids those issues. It searches through all files in the currect directory and report names of any that contain <cert> on one line and </cert> on the next:
awk 'last ~ "<cert>" && $0 ~ "</cert>" {print FILENAME; nextfile} {last=$0}' *
How it works
awk implicitly loops over all lines in a file.
This script uses one variable, last, which contains the text of the previous line.
last ~ "<cert>" && $0 ~ ""`
This tests if (a) the last line contains the characters <cert> and (b) the current line contains the characters </cert>.
If you actually wanted lines that contain <cert> and no other characters, then replace ~ with ==.
{print FILENAME; nextfile}
If the preceding condition returns true, then this prints the file's name and starts on the next file.
(nextfile was a common extension to awk that became POSIX 2012.)
{last=$0}
This updates the variable last to have the current line.

Resources