0

I have one file with root ownership,

-rw-r--r--    1 root    staff  92229 Feb  6 10:51 oneFile
-rw-rw----@   1 John  staff     5242880 Feb  7 00:14 anotherFile

How can I change oneFile ownership and read write permission to be the same as anotherFile?

Bruni
  • 10,542
Leem
  • 111

1 Answers1

3

Provided you mean in a bash terminal, this is the way to go:

sudo chmod --reference=anotherFile oneFile
sudo chown --reference=anotherFile oneFile

From man chmod

CHMOD(1)

NAME
       chmod - change file mode bits

SYNOPSIS
       chmod [OPTION]... MODE[,MODE]... FILE...
       chmod [OPTION]... OCTAL-MODE FILE...
       chmod [OPTION]... --reference=RFILE FILE...
Bruni
  • 10,542