You can use the -R (recursive) option to the chown and chmod commands, for example you could do something like this:
chown -R x directoryname
chmod -R u+rwx directoryname
The chown -R command then sets the user x as the owner of that directory and everything inside. The chmod -R u+rwx command grants the owner read, write, and execute permission for that directory and everything inside.
It would help if you give a little more information about what exactly you are trying to do, but...
Ubuntu by default uses Owner-Group-All permissions. I am assuming that you want "User-X" to have access to a directory that it owned by "User-Y"
First, Create a group for "User-X" and "User-Y", and add those users to the group - replace
<userGroupName>
with a name that makes sense to youSecondly, change the group ownership of the directory in question
Where
<directoryName>
is the directory that you are working uponFinally, change permissions at the directory to allow the owning group, (
<userGroupName>
), appropriate permissions.If the group is non-empty, you may wish to change the permissions of all files and folders in the directory:
You can use the
-R
(recursive) option to thechown
andchmod
commands, for example you could do something like this:The
chown -R
command then sets the user x as the owner of that directory and everything inside. Thechmod -R u+rwx
command grants the owner read, write, and execute permission for that directory and everything inside.