4

Are there any files, like in ~/.config or elsewhere, in the home directory that should be owned by root?

Will recursively changing the ownership of every file in my user's ~ to be my user be harmful?

2
  • 2
    Recursive option is -R or --recursive
    – saji89
    Jan 31, 2014 at 4:19
  • 1
    Beware of rare edge cases when literally executing the command in the title, $USER and $HOME can be changed. E.g. USER=nobody; HOME=/; sudo chown -R $USER $HOME is unsafe. Also, you can find files not owned by you using find ~ ! -user $USER -ls (again, assuming a sane environment where the variables have not been changed).
    – Lekensteyn
    Jan 31, 2014 at 13:39

2 Answers 2

1

Are there any files, like in ~/.config or elsewhere, in the home directory that should be owned by root?

No you should be the owner of all the files and folders under your home.

What may be the possible trouble otherwise?

In your home there exists many user level settings for various applications and system itself in the hidden files and folders. If you chown them to root you will be in trouble in the next login. At the time of login your profile could not be loaded as you have no longer access permission to the configuration files. And you will be most probably kicked out to the login screen. In the process you will lock yourself.

Will recursively changing the ownership of every file in my user's ~ to be my user be harmful?

There is no harm in doing so. But keep in mind the case as pointed out by Lekensteyn in the comment above. I am quoting it,

Beware of rare edge cases when literally executing the command in the title, $USER and $HOME can be changed. E.g. USER=nobody; HOME=/; sudo chown -R $USER $HOME is unsafe.

There is a better proposal than to recursive chown in the comment above,

you can find files not owned by you using find ~ ! -user $USER -ls (assuming a same environment where the variables have not been changed). And rename only those files.

3
  • I was asking whether changing all the ownerships to my user would be harmful. (:
    – Richard
    Jan 31, 2014 at 12:56
  • @Lekensteyn I have added your comment in my answer without asking you. Hope you will not mind.
    – sourav c.
    Jan 31, 2014 at 14:46
  • @searchfgold6789 I have edited my ans. Plz take a look.
    – sourav c.
    Jan 31, 2014 at 14:47
1

All of the files and directories in your home directory(/home/user) should be owned by your user.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .