Change Owner
Changing the File Owner and Group A file's owner can be changed using the chown command. For example, to change the foobar file's owner to tux:
user@host:/home/user$ sudo chown tux foobar
To change the foobar file's group to penguins, you could use either chgrp or chown with special syntax:
user@host:/home/user$ sudo chgrp penguins foobar
user@host:/home/user$ sudo chown :penguins foobar
Finally, to change the foobar file's owner to tux and the group to penguins with a single command, the syntax would be: user@host:/home/user$ sudo chown tux:penguins foobar
Note that, by default, you must use sudo to change a file's owner or group.
user@host:/home/user$ sudo chown tux foobar
To change the foobar file's group to penguins, you could use either chgrp or chown with special syntax:
user@host:/home/user$ sudo chgrp penguins foobar
user@host:/home/user$ sudo chown :penguins foobar
Finally, to change the foobar file's owner to tux and the group to penguins with a single command, the syntax would be: user@host:/home/user$ sudo chown tux:penguins foobar
Note that, by default, you must use sudo to change a file's owner or group.
Comments
Post a Comment