Thursday, May 2, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 869  / 2 Years ago, mon, july 4, 2022, 10:56:22

For example I have two users A and B and A has admin privileges.



I am logged in as B and I want to know how can I copy /etc/sudoers in B home directory in a single command and after /etc/sudoers is copied it must be owned by B user by default , without using chmod, chown.



I hope I made myself clear.


More From » command-line

 Answers
0

If you don't want to use chown or chmod, you can use one of the following methods (in any case you need to have root privileges to read /etc/sudoers file):



sudo cat /etc/sudoers > ~/sudoers


or:



touch ~/sudoers
sudo cp /etc/sudoers ~/sudoers


In both cases, after ~/sources file is created, is owned by the current user.


[#29966] Wednesday, July 6, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
rofity

Total Points: 182
Total Questions: 98
Total Answers: 115

Location: Albania
Member since Sat, Jan 7, 2023
1 Year ago
;