I would like to know if rwx access on Linux file system can substitute sudo access to run a command.

i.e.: I have the command abcd in /etc/init.d/ and I do have rwx access for /etc/init.d/ directory and its contents. Do I need have sudo access to execute the command abcd (user@server:/>sudo abcd) or I can type only user@server:/>abcd at the command prompt?

  • 3
    Just because you have permission to execute a file, doesn't mean you will have permission to do what the script does. – jordanm Dec 21 '12 at 17:07

Running abcd directly and via sudo are completely different things (assuming you're not root to begin with).

The permissions on the file will allow you to execute it as yourself, i.e. without extended privileges.
Running that program via sudo will run it with root privileges.

Whether running it directly will actually do what you want depends on the program. But keep in mind that generally, the result will not be the same at all.

  • I got it. Running as myself (without privileges) I can get error if the command calls for any data or other command outside the main folder. Correct? – Emerson Ivo Dec 21 '12 at 17:14
  • 1
    You'll get problems whenever the command you started needs to access resources (of any type) that you user can't. – Mat Dec 21 '12 at 17:17
  • One lest question: May I inform all syntaxes available to cofigure SUDO or it doesn't matter running commands through SUDO? – Emerson Ivo Dec 21 '12 at 17:25
  • 1
    I don't understand your comment. Running things with sudo should be done only when they require to be run as root. sudo access must be limited as much as possible for normal users. – Mat Dec 21 '12 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.