I encountered problem from sudo, when I input this command 'su -c 'echo eric ALL=(ALL) ALL >> /etc/sudoers'
Password:
bash: -c: line 0: syntax error near unexpected token `('
bash: -c: line 0: `echo eric ALL=(ALL) ALL >> /etc/sudoers'
What can I do? How can I use sudo without need to input the root passwords or user passwords
I hear that visudo command can do this, but how to do that?
I searched many web site from www.google.com, but no one was helpful.
Any suggestion would be welcome. Thanks in advance!
sudo problem
Re: sudo problem
If you intend to delegate root powers to a user and give that user permission to run any command with sudo, add this user to the group named "wheel". You can find the powers of the "wheel" group given in the /etc/sudoers file
You should avoid to change the /etc/sudoers file. It's contents may change when the containing package is updated. If you want to add some sudo permissions, put that in a file in the /etc/sudoers.d directory. Any file in that directory is appended to the contents of /etc/sudoers . Files in /etc/sudoers.d should be owned by root and writable only by root.
'(' and ')' have special meaning for the shell. Anything between these two characters is executed in a sub-shell.
You can avoid this by adding some double-quotes:
Code: Select all
usermod -a -G wheel user_name
'(' and ')' have special meaning for the shell. Anything between these two characters is executed in a sub-shell.
You can avoid this by adding some double-quotes:
Code: Select all
su -c 'echo "eric ALL=(ALL) ALL" >> /etc/sudoers.d/erics_sudo_grants
Re: sudo problem
And whenever you change sudoers you should use the visudo command to do so as it syntax checks the file before it saves it so you cannot break it (if you have a syntax error in the file then sudo fails to work at which point you cannot edit the file to fix it...). If you edit a file in /etc/sudoers.d then use visudo with the -f switch to point it to the file you are editing there.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke