Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Console Foundations Users and Permissions File Ownership

Changes to hello.txt under a different user

After changing the owner from the user 'treehouse' to the user 'mike' changes are made to the file hello.txt. However the home directory is still that of the user 'treehouse'. Why wasn't the 'cd' command used to change the home directory of 'mike'? Wouldn't the changes be saved in the 'treehouse' directory?

1 Answer

cd is the command for changing directory. You would use the chown command to change the ownership of something (files or directories), and the -R flag to make it recursive (all contents/children) if changing the ownership of a directory:

chown -R treehouse:mike treehouse/

Not sure you'd want to do that for a user's home directory though...