My Notes about sudo: (PLEASE NOTE - my notes are just my collection from our very own google only. i post them because it may help newbies, slow-learners like me;).. if you say the info isnt correct, or just a copy from wiki, or plagiarism, blah blah blah, then let me know thru a comment, i would be very happy to delete my post, than your down-votes )
From wiki page:
- Unlike the su command, users typically supply their own password to sudo rather than the root password.
- sudo is able to log each command run. Where a user attempts to invoke sudo without being listed in the sudoers file an error is presented to the user indicating that the attempt has been recorded in the system log.
- sudo may be configured to require the root password, or no password at all
- This file MUST be edited with the 'visudo' command as root. from wiki - visudo is a command-line utility that allows editing of the /etc/sudoers file in a safe fashion. It opens /etc/sudoers, using the vi editor's interface by default (although this can be changed by setting the shell's EDITOR environment variable to a different text editor), prevents multiple simultaneous edits with locks, performs sanity checks and checks for parse errors.
- The runas command provides similar functionality in Microsoft Windows but cannot pass current directories, environment variables or long command lines to the child. And while it supports running the child as another user, it does not support simple elevation. A true su and sudo for Windows that can pass all of that state information and start the child either elevated or as another user (or both) is included with Hamilton C shell.
- There exist several frontends to sudo for use in a GUI environment, notably kdesudo, and gksudo
From man page:
To get a file listing of an unreadable directory:
% sudo ls /usr/local/protected
To list the home directory of user yazza on a machine where the filesystem holding ~yazza is not exported as root:
% sudo -u yazza ls ~yazza
To edit the index.html file as user www:
% sudo -u www vi ~www/htdocs/index.html
To shutdown a machine:
% sudo shutdown -r +15 "quick reboot"
FAQ and Troubleshooting Tips