Problem scenario
You are running Linux. You think quotas are not properly configured. You run “repquota -au” and see soft and hard limits. You see grace periods. But you are not sure if quotas are enabled or not. What should you do?
Solution
Run this:
sudo quotaon -ap
To enable groups, run this:
sudo quotaon -ag
To enable user quotas,
…
Continue reading “How Do You See if the quota Has been Properly Enabled?”
Problem scenario
You are using Ubuntu Text Editor. You want to redo an undone change. How do you accomplish this?
Solution
Right click somewhere in the text.
Go to “Redo”
…
Continue reading “How Do You Redo (Undo an Undo) a Change in Text Editor?”
Problem scenario
The grace period says “none”. Clearly the grace period expired. The soft limit has been exceeded and maybe even the hard limit has exceeded. Files are still created. You would expect to see a “write failed…quota reached” or “quota exceeded” any time a user tried to create a new file or directory. What should you do?
Solution
Run this:
quotaon -ap …
Continue reading “How Do You Determine Why the quota System is Working?”
Problem scenario
You know foobar.html is in a directory on a web server that houses index.html. You cannot go to foobar.html in a web browser — but you can go to index.html. How do you fix this?
Possible solution #1
Are the permissions of foobar.html different from index.html? Is there a slight spelling error in the file name on the back-end?
…
Problem scenario
You want to combine several PDF files. But you don’t want to upload them to a website. How do you do this for free with a Debian distribution of Linux?
Solution
Run this command:
sudo apt -y install poppler-utils
Run this command (where 1.pdf is the first file you want to be merged with the first pages,
…
Question
You have seen “<(” in Linux. What does it do?
Answer
A command encapsulated in parens and having the “<” symbol on the left is a way to do process substitution.
Here is an example:
diff <(hostname -f) <(date)
The diff command can compare the results of two different commands. To read more about process substitution,
…
Continue reading “What Does the Less-than and Parentheses Syntax in Linux/Bash Signify?”
Problem scenario
You want passwords to rotate periodically for all users. You modified the /etc/login.defs file, and new users are inheriting the temporal rotational policies for passwords. How can pre-existing accounts be forced to periodically change their password?
Solution
Use this command for every password (but replace “jdoe” with the user you want to change and replace “30” with the number of days you want the password to last for before the user is forced to change it):
sudo chage -M 30 jdoe
# The user can still log in one more time after expiration. …
Continue reading “How Do You Get Passwords to Expire for Existing Users?”
Problem scenario
You are running Linux with a multi-core CPU and motherboard. You want to turn off simultaneous multithreading (because in some use cases the performance can improve or you are concerned about security). What should you do?
Possible Solution #1
If you want to be able to turn it back on without rebooting, you could have a crontab job run a script at reboot.
…
Continue reading “How Do You Disable Hyperthreading in Linux?”
Problem scenario
Using Python, you want to parse a log file. You want to print out entries that have a datetime stamp that are within 24 hours of a given date.
The log file is in this format:
Sep 18 07:28:11 server1 sshd[29284]: Received disconnect from 115.52.17.109 port 46970:11: Bye Bye [preauth]
Sep 18 07:28:11 server1 sshd[29284]: Disconnected from 115.52.17.109 port 46970 [preauth]
Sep 18 07:28:11 server1 sshd[29282]: Failed password for root from 51.10.7.109 port 24844 ssh2
Sep 18 07:28:13 server1 sshd[29287]: pam_unix(sshd:auth): authentication failure; …
Continue reading “Using Python How Do You Print Log Entries for a Given Time Range?”