Linux Chown: Assign Directory Ownership

To assign ownership of a directory to a user, you can use the chown command. For example, to assign ownership of a directory named /home/user1/directory1 to user2, you can use the following command:

sudo chown user2 /home/user1/directory1

To transfer ownership of the directory /home/user1/directory1 to user2, use the -R parameter to also assign ownership of all files and subdirectories within the directory.

sudo chown -R user2 /home/user1/directory1
bannerAds