LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to get around tar'ing up files you don't have permissions? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-get-around-tar%27ing-up-files-you-don%27t-have-permissions-4175542962/)

superbbrr 05-18-2015 08:43 PM

How to get around tar'ing up files you don't have permissions?
 
I would like to tar up some system logs with core files as a normal user through a script. However these core files are owned by root.

Of course I get "cannot read directory ...: Permission denied"

Is there a good way to grab these core files through a script? From searching around, I get that the best way is to modify the sudoers file, then run the script with sudo. Is this considered the safest and best way?

Thanks!

John VV 05-18-2015 08:49 PM

you do not

you become root , then tar them up

the logs are owned by root

you could set a cron job

but "log rotate" should be doing that


All times are GMT -5. The time now is 12:16 PM.