How Do You Troubleshoot “mount: /foobar: must be superuser to use mount” when You Open a Terminal in Linux?

Problem scenario
When you open a terminal or log into a Linux server, you see a message like this:

"mount: /foobar: must be superuser to use mount."

You suspect some bash script is running every time you log in. What should you do?

Possible solution #1
If you are running a Red Hat server, go to /etc/profile.d/. Sort the files by time modified like this:

ls -lh --sort=time

Look for a script that is trying to mount foobar.

Possible solution #2 (more of a tip to lead to a solution):
Run this command to find the directory that is attempted to be mounted:

sudo find / -name foobar

Is the directory corrupt?

Possible solution #3 (more of a tip to lead to a solution):

df -h | grep foobar

Possible solution #4 (more of a tip to lead to a solution):

cd /
sudo grep -R foobar

Leave a comment

Your email address will not be published. Required fields are marked *