Click to See Complete Forum and Search --> : chmod question


nac-nac
05-21-2001, 11:06 AM
When chmod is changed will the grp and owner change to root, if I'm logged in as root?

For example. I successfully change group and ownership of a file with the command chown newowner.newgroup filename.

After this I attempt to change permissions with chmod 660 filename.

This resets owner/group to root. I've done this a few times to make sure I was not mistyping anything.

If chmod does reset owner/group, how do I change permissions while preserving the existing owner/group?

[rh 7.0]

klamath
05-21-2001, 11:24 AM
Works for me.

As root:

# touch test
# ls -l
(test is mode 644, owned by root.root)
# chown nobody.nogroup test
# ls -l test
(test is mode 644, owned by nobody.nogroup)
# chmod 600 test
# ls -l test
test is mode 600, owned by nobody.nogroup)

nac-nac
05-21-2001, 11:30 AM
What OS?

X_console
05-21-2001, 12:02 PM
I get the same results as Klamath. And I don't think you mean "what OS" but rather "what distribution". :) For me it would be Slackware. I think Klamath is using Debian if I remember correctly.

nac-nac
05-21-2001, 12:07 PM
Cool, noted the distinction between OS and distro.

The problem is not a bug. The server I'm working on has a brother machine that synchs the files every minute. It dawned on my that I was logged into the wrong machine, and the directories were being updated moments after I'd change the permissions.

I appreciate you reading the post and trying to help. :)

Travis Shofner
05-21-2001, 01:18 PM
Just a side question: what is the command or how can you see what group a user is in? For that matter, how do you see a "list" of users? Is there a specific command? I'm not at my box right now :( *kicks windows 98*

(I just KNOW someone is going to say "Yeah, it's cat /etc/users or something :P)

X_console
05-21-2001, 04:52 PM
Travis: To find out what groups a user is in, type "groups username" Eg:

xconsole@moonfrog:~$ groups root
root : root bin daemon sys adm disk wheel floppy

As for gettling a list of users, it's "less /etc/passwd"

Travis Shofner
05-21-2001, 06:51 PM
Elite, muchos thank yous.