LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Every file I create has a group different than root. How do I find out where this is (https://www.linuxquestions.org/questions/linux-software-2/every-file-i-create-has-a-group-different-than-root-how-do-i-find-out-where-this-is-168114/)

rfelter 04-09-2004 09:20 AM

Every file I create has a group different than root. How do I find out where this is
 
Every file I create is created with a group that is not root. I would like all files being created to have root as the group. Where is this set? I am logged on as root.

larrykeenan 04-09-2004 10:42 AM

Every new file or directory that you create will have some set of default permissions assigned to it. You can set what these permissions will be with the umask command.
You can read about umask in your bash manual then place the relevent umask= line in the hidden .bashrc file.

All Linux users have a user ID and a group ID. Change your group ID back to root (gid=root)

BTW I wouldn't be logged in as root for long not knowing what I was doing.

Hope this helps,
Larry Keenan

GregLee 04-09-2004 01:28 PM

Users are assigned to groups by entries in the file /etc/passwd. The first line of my passwd file is "root:x:0:0::/root:/bin/bash". The first "0" is root's user id, and the second "0" is root's group id. The name of group 0 is given in the file /etc/group, which on my system has the line "root::0:root", where the first "root" is the name assigned to the group whose id is "0". So check out these two files on your system to make sure that root is assigned to group 0 and the name of group 0 is "root".

jmelling 04-16-2004 06:04 AM

Larry,
umask sets read/write/execute permissions for user/group/other. It masks the permissions if defined in your profile if undefined unix default permisions are 666 (rw-rw-rw-) a umask of 022. changes the defaults to (rw-r--r--)

here's the simplistic math:
rwx=7 octally (base 8=111) read,write,execute
rw=6 octally 110 (notice last digit is 0 or off = no execute)
rx=5 octally 101
r=4 octally 100
wx=3 octally 011
w=2 octally 010
x=1 octally 001 (execute only)
000 no joy..never seen this but could happen...

so if we look at unix defaults and convert to octal:

default 666 = rw-rw-rw-
umask 022 = -0 -2 -2 (standard umask on base os install)
final result 644 = rw-r--r-- changes group and everyone else to read only

umask has nothing to do with group id (gid membership)..only file read/write/execute permissions only..

GregLee is correct...but I noticed your a "newbie" and I thought it value added to clarify how umask is used...I hope it helps.

larrykeenan 04-16-2004 09:28 AM

Thanks - Well Explained.

Larry Keenan


All times are GMT -5. The time now is 03:01 AM.