LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-14-2012, 10:50 AM   #1
masuch
Member
 
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 135

Rep: Reputation: 1
Question 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.
 
Old 07-14-2012, 11:01 AM   #2
snowday
Senior Member
 
Registered: Feb 2009
Posts: 4,667

Rep: Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411
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.
 
Old 07-14-2012, 02:20 PM   #3
honeybadger
Member
 
Registered: Aug 2007
Location: India
Distribution: Slackware (mainly) and then a lot of others...
Posts: 855

Rep: Reputation: Disabled
+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.
 
Old 07-16-2012, 05:00 AM   #4
masuch
Member
 
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 135

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by snowpine View Post
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.
It is too late to satisfy such recommendation. I am doing it quite often :-)
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
...
...
 
Old 07-16-2012, 05:37 AM   #5
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,279

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
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------).
 
Old 07-16-2012, 06:55 AM   #6
masuch
Member
 
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 135

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by eSelix View Post
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------).
Thanks for info.

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://localhostort - 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 ?
 
Old 07-16-2012, 04:39 PM   #7
psyhe
LQ Newbie
 
Registered: Mar 2006
Posts: 5

Rep: Reputation: 1
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.
 
Old 07-17-2012, 04:14 PM   #8
masuch
Member
 
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 135

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by psyhe View Post
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.
Thank you for info.

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 :-)
 
Old 07-17-2012, 04:42 PM   #9
snowday
Senior Member
 
Registered: Feb 2009
Posts: 4,667

Rep: Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411
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
 
Old 07-17-2012, 05:41 PM   #10
masuch
Member
 
Registered: Sep 2011
Location: /dev/null
Distribution: ubuntu 64bits
Posts: 135

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by snowpine View Post
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
Your suspicion is completely incorrect :-)
 
Old 07-17-2012, 06:02 PM   #11
snowday
Senior Member
 
Registered: Feb 2009
Posts: 4,667

Rep: Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411Reputation: 1411
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.
 
  


Reply

Tags
owner, permission, root, user


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
permission denied to paste files to secure micro chip. 'owner' is 'root'. who?me? Linux - Newbie 1 05-03-2009 08:46 AM
permission denied to paste files to secure micro chip. 'owner' is 'root'. who?me? Linux - Newbie 1 05-03-2009 08:40 AM
Why is access denied to files I haven't made but I'm the owner, I'm the root. Sonhi Fedora 8 08-12-2008 08:11 AM
Files and directories under the root sathish80 Linux - General 2 03-16-2006 03:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration