can /root contain files/directories with different owner to root ?
Hi,
I have came across the /root directory which contains many files and directories with not root owner-ship - owner is in most cases like "normal" user name. Is it correct ? Would it be better to change owner in '/root' ,for all files/directories, to root owner ? thank you, M. |
Do you have some specific examples to discuss? Hard for me to answer vague hypotheticals...
In general I recommend that you never edit, delete, alter, or change permissions of any file in /root, ever. All the files you need for everyday tasks are located in your /home folder. |
+1 snowpine.
The user of all the / files is root (assumed) what group will you assign the files to? Some files (esp in /dev) have differnet gropus (eg audio, lp etc). So do not change anything. |
Quote:
Please, I would like to talk about /root directory. Last change I did was for /root/.config sub-directory/ies owner:group to root:root 3 days ago. My question was if it is correct that some directories in /root directory can have different owner:group than root:root and why ? For instance: .config .i2p .emacs.d .Foxit .local .pki !!!??? .TrueCrypt ... ... |
Yes, it is correct (but can be unsafe). Also nothing bad will happen when you change ownership to root. The /root directory is your - administrator home directory and no other users need to access it. @honeybadger - OP talking about "/root" directory not "/". How it happens? - for example when you copy file owned by other user to this directory, the owner is not changed. Other reasons I don't known. Check that your /root directory has proper permissions (ex. root:root rwx------).
|
Quote:
Example: what's bothering me - I know exactly which directories I have copied to /root manually. But there is a lot of directories created by "normal" application/s and have owner:group as myuser:myuser and/or rwxrwxrwx permission/s. For example /root/.pki which contains cert9.db , key4.db pkcs11.txt which seems to me like very unsafe. I have been expecting if some application (started by sudo or under root user (as from terminal as from desktop)) is going to create some directory structure under /root - it should be always root:root rwx------ , but there is too many exceptions - so I am probably going to to chown root:root for whole /root dir/subdirs. About rwx------ permission/s I have no idea what is/is not correct. (just guess - for example /root/.i2p - when I run web browser under "normal user" go to http://localhost:port - application probably needs some files with read access permission (to show configurations/status/logs/etc.) - I guess). Does exist any rules/documentation/info how it should be (what is/is not allowed) or does it depend only on application/developer how file permission/s are managed ? |
In general, it is best and common for you to have a separate user, for example named 'myuser', with a home folder /home/myuser/ . 99% of all your activities should be done using this user.
When you need to become root (to administrate your system/install packages, etc. ), you run 'sudo bash' or 'su' . Answering the original question - it is correct to have files in the /root/ folder owned by another user, in the sense that the kernel does not care, but it is not recomended. The /root/ folder is best to be kept chmod 700 (drwx------) which means that a program started as an ordinary unix user will not have access to the files in /root/ even if the file in question is in fact owned by the ordinary unix user. |
Quote:
So, It should be correct and safe and should not create any inconsistencies if I do: chown root:root -R /root chmod 700 -R /root I just want to be sure that I can do it - that's all this question/post is about :-) |
From your question I suspect you may not be using the recommended Ubuntu procedure of sudo for terminal commands as root, and gksu for graphical apps as root.
https://help.ubuntu.com/community/RootSudo http://www.psychocats.net/ubuntu/graphicalsudo |
Quote:
|
Sorry, I missed your post #6. Copying a file does not change its permissions. If you are copying file(s) from your user account to root then yes file ownership by the user will be maintained.
|
All times are GMT -5. The time now is 12:54 PM. |