Check These Out
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token.
This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use:
`awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'`
You must adapt the command line to include:
* $MFA_IDis ARN of the virtual MFA or serial number of the physical one
* TTL for the credentials
using bc is for sissies. dc is much better :-D
Polish notation will rule the world...
Converts any number of seconds into days, hours, minutes and seconds.
sec2dhms() {
declare -i SS="$1"
D=$(( SS / 86400 ))
H=$(( SS % 86400 / 3600 ))
M=$(( SS % 3600 / 60 ))
S=$(( SS % 60 ))
[ "$D" -gt 0 ] && echo -n "${D}:"
[ "$H" -gt 0 ] && printf "%02g:" "$H"
printf "%02g:%02g\n" "$M" "$S"
}
Same as previous but compatible with BSD/IPSO
In this case, linux- is the prefix; simply running
$apt-cache pkgnames
would list every package APT knows about.
The default APT config assumes -g, --generate; to use the cache as/is, you could similarly run:
$apt-cache --no-generate pkgnames [prefix]
Adding --all-names, like so:
$apt-cache --no-generate --all-names pkgnames [prefix]
would print all the packages APT knows about, using the cache as/is, including virtual packages and missing dependencies.
This command was shamelessly stolen from the apt-cache(8) man-page.
swap out "80" for your port of interest. Can use port number or named ports e.g. "http"
The correct way to restart openssh-server on your synology nas.
This command shows a sorted list of the IP addresses from which there have been authentication errors via SSH (possible script kiddies trying to gain access to your server), it eliminates duplicates so it's easier to read, but you can remove the "uniq" command at the end, or even do a "uniq -c" to have a count of how many times each IP address shows in the log (the path to the log may vary from system to system)
Show the number of failed tries of login per account. If the user does not exist it is marked with *.
Friday is the 5th day of the week, monday is the 1st.
Output may be affected by locale.