sudo command corrupted
Why my sudo command is running in this way? I think this command is corrupted. How to fix this?
MacBook Pro 13″, macOS 11.6
Why my sudo command is running in this way? I think this command is corrupted. How to fix this?
MacBook Pro 13″, macOS 11.6
What do you want to use sudo for?
sudo is not supposed to be used this way.
You should type
sudo <command>
where <command> is whatever you need to execute with elevated privileges.
For example you might do
sudo tmutil deletelocalsnapshots /
to delete Time Machine snapshots.
You don't just type "sudo" on its own.
So: what do you need sudo for?
Careful: if you are not sure, just don't. You risk making your mac unbootable.
What happens when the command " man sudo " without quotation marks is run??
How did you install java in the first place?
Either you have an uninstaller (best), or you get specific instructions for uninstalling; "some sudo" is not nearly specific enough.
Or... you just leave it be. Having java won't do much unless you try to run java applications.
No. But is writeable can create any problem?
Yes. Someone can modify the sudoer files to add elevated privileges for processes and users.
If you successfully ran the chmod command, it should no longer be writeable.
Since you had to use the sudo command to run the change mode command, it will report the status of sudoers.d directory when it runs. If you run sudo now, do you still get errors?
If you just run sudo at the prompt with nothing else, you should get the usage instructions and no errors.
Agree with @ Luis Sequeira1 - Terminal is not forgiving - one mistype and presto - the computer could become unusable.
I don't know actually. But once I had tried to run a sudo command and it was running and shut that terminal off. Can you please help me to reset sudoers file?
I want to uninstall java from my macbook. For that I have to run some sudo <command>. Can you just help me to reset sudo command?
after running "visudo" command, this has come up. Now what to do?
That commands are giving these outputs. Can you please tell me how to solve this problem completely?
Of course it will show that error when you run the command that fixes it. It was still writeable at that time.
Does it show that error anymore?
No. But is writeable can create any problem?
You certainly do have something wrong with your sudoers file, which may be the cause of the other errors, but I don't know.
Something has made the file writeable, which it should not be. That is why it cannot find any valid sources.
Perhaps editing it with visudo will make it unwritable, but I would remove everything in the file and copy into it valid sudoers file contents.
Do you know of anything you've installed that would attempt to alter the sudoers file?
ramim1207 wrote:
I want to uninstall java from my macbook. For that I have to run some sudo <command>. Can you just help me to reset sudo command?
I can post what is in my sudoers file and you can use visudo to create a new file, but why would you trust anybody on the internet?
#
# Sample /etc/sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
##
# Override built-in defaults
##
Defaults env_reset
Defaults env_keep += "BLOCKSIZE"
Defaults env_keep += "COLORFGBG COLORTERM"
Defaults env_keep += "__CF_USER_TEXT_ENCODING"
Defaults env_keep += "CHARSET LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE"
Defaults env_keep += "LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME"
Defaults env_keep += "LINES COLUMNS"
Defaults env_keep += "LSCOLORS"
Defaults env_keep += "SSH_AUTH_SOCK"
Defaults env_keep += "TZ"
Defaults env_keep += "DISPLAY XAUTHORIZATION XAUTHORITY"
Defaults env_keep += "EDITOR VISUAL"
Defaults env_keep += "HOME MAIL"
Defaults lecture_file = "/etc/sudo_lecture"
##
# User alias specification
##
# User_Alias FULLTIMERS = millert, mikef, dowdy
##
# Runas alias specification
##
# Runas_Alias OP = root, operator
##
# Host alias specification
##
# Host_Alias CUNETS = 128.138.0.0/255.255.0.0
# Host_Alias CSNETS = 128.138.243.0, 128.138.204.0/24, 128.138.242.0
# Host_Alias SERVERS = master, mail, www, ns
# Host_Alias CDROM = orion, perseus, hercules
##
# Cmnd alias specification
##
# Cmnd_Alias PAGERS = /usr/bin/more, /usr/bin/pg, /usr/bin/less
##
# User specification
##
# root and users in group wheel can run anything on any machine as any user
root ALL = (ALL) ALL
%admin ALL = (ALL) ALL
## Read drop-in files from /private/etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /private/etc/sudoers.d
I have no idea if replacing your sudoers file will solve the rest of the issues.
Hi ramim1207,
To uninstall Java, use Barney-15E's suggestion (delete the relevant folders specified).
To reset your sudoers file back to good condition, try these steps. It is imperative that they are followed exactly as written.
EDIT: Once the sudo command is repaired, don't use it unless you know exactly what you're doing with it. Using sudo allows you to run any command as the root user, which is the most powerful (and dangerous) user on your Mac. Even though the root user may be "disabled" on your Mac, it can always be accessed through sudo.
The default sudo policy only allows administrators to use it. If you have multiple users on your Mac, most of them should be made standard users so that they cannot abuse sudo.
Is it ok now?
Copy and paste in this command:
ls -dl /private/etc/sudoers.d
If the returned line does not start with drwxr-xr-x, run this command:
sudo chmod 755 /private/etc/sudoers.d
Did you ever do anything to change the permissions on the startup drive? Based on both of those items being "world writeable," it appears you have have changed permissions and used "Apply to Enclosed" in the gear menu or used the chmod command to change permissions on the entire drive. If you did, you will likely have lots of other random/strange issues besides this one.
sudo command corrupted