Skip to main content
The pronoun 'I' should be capitalized; English contractions use apostrophes.
Source Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 265

I want to grep something inside a directory. But the user dontdoesn't have permissions in the direcotrydirectory. Because of some reasons, iI am not allowed to change permissions, group or owner. Just want to know iI can access that directory by some entry in the sudoers file.

grep -r "some phrase" /path/to/restricted-dir

Is there any way to execute the above command using SUDO. sudo?

I want to grep something inside a directory. But the user dont have permissions in the direcotry. Because of some reasons, i am not allowed to change permissions, group or owner. Just want to know i can access that directory by some entry in the sudoers file.

grep -r "some phrase" /path/to/restricted-dir

Is there any way to execute the above command using SUDO. ?

I want to grep something inside a directory. But the user doesn't have permissions in the directory. Because of some reasons, I am not allowed to change permissions, group or owner. Just want to know I can access that directory by some entry in the sudoers file.

grep -r "some phrase" /path/to/restricted-dir

Is there any way to execute the above command using sudo?

edited tags
Link
Gilles 'SO- stop being evil'
  • 865.4k
  • 205
  • 1.8k
  • 2.3k
Source Link

Using SUDO to execute a general command inside a non-accessible directory

I want to grep something inside a directory. But the user dont have permissions in the direcotry. Because of some reasons, i am not allowed to change permissions, group or owner. Just want to know i can access that directory by some entry in the sudoers file.

grep -r "some phrase" /path/to/restricted-dir

Is there any way to execute the above command using SUDO. ?