cancel
Showing results for 
Search instead for 
Did you mean: 

Prblm in Delegation of Rights ... Plz help

SOLVED
Maaz
Valued Contributor
Solved!

Prblm in Delegation of Rights ... Plz help

Dear All,

there is an ordinary user named 'marshall'. i want, even have to give marshall backup rights, i.e. he can take backup of ANY files/folder in the /home and /opt directories.

Any1 can plz let me know what I have to wirte in /etc/sudoers, to acheive the task, i mentioned above

Thanks in Advance

Best Regards
Maaz

4 REPLIES 4
Senthilmurugan
Frequent Advisor
Solution

Re: Prblm in Delegation of Rights ... Plz help

Hello Maaz,

Edit the /etc/sudoers using "visudo"

#visudo

Place and entry

marshall hostname= NOPASSWD: /bin/cp -R /home /home/marshal/homedirbackup

marshall hostname= NOPASSWD: /bin/cp -R /opt /home/marshal/optdirbackup


And save the entry. Now execute as

#sudo /bin/cp -R /home /home/marshal/homedirbackup
#/bin/cp -R /opt /home/marshal/optdirbackup
Now you can be able to copy all the entries of home and /opt directories

Note: Change the hostname to your hostname. The permissions of the copied file will be same as the original files.

Regards,
Senthil Murugan
Senthilmurugan
Frequent Advisor

Re: Prblm in Delegation of Rights ... Plz help

Hello Maaz,

For the previous reply the, owner of the copied file will be "root" only .To preserve the file permissions use "-p" option with the cp command

Regards,
Senthil Murugan
Ross Minkov
Esteemed Contributor

Re: Prblm in Delegation of Rights ... Plz help


Actually there is a switch to cp that is even better for backup/archive jobs than -p:

-a or --archive (same as -dpR)

==================================
-d same as --no-dereference -- preserve=link
-p same as --preserve=mode,ownership,timestamps
-R, -r, --recursive
copy directories recursively
==================================

HTH,
Ross

Maaz
Valued Contributor

Re: Prblm in Delegation of Rights ... Plz help

Dear Senthil Murugan
I m highly Thankful to u, for ur kind support.
U have solved my prblm
following line, i add in the /etc/sudoers

marshall CRM1 = NOPASSWD: /bin/tar -cpvf /home/marshal/* /opt
marshall CRM1 = NOPASSWD: /bin/tar -cpvf /home/marshal/* /home and its working 100%.

Again Many Thanks

And Ross Minkov, thanks for ur asistance as well. I higly apprecitae ur's suggestion

Best Regards
Maaz