LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 12-11-2023, 11:15 PM   #1
NewUser0001
LQ Newbie
 
Registered: Dec 2023
Posts: 3

Rep: Reputation: 0
/etc/passwd and /etc/shadow - changing owner and group


Hi,

VERY new user here, but would there be any benefit from changing the /etc/shadow or /etc/passwd owner and group to a different users besides root?

I am looking at this from a security's perspective. I assumed root would be the most logical user and group to keep it as, but I have a some documentation(internal) here that asks me to change these two files owner and group. I assume this would make it less secure as it gives Root + the owner + the group access instead of just root.

Appreciate any assistance or advice here!
 
Old 12-11-2023, 11:52 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,864

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
Is this a homework question? Or where is it coming from? What kind of documentation is it?
I guess you can easily try if that works at all (in a VM). Theoretically you can change owner/group to a non existent account too.
 
Old 12-12-2023, 05:38 AM   #3
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,798

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
You are right, it would lower security.
Further, integrity/security checkers would complain.
Further, the owner/group/permissions are in the package DB, and can be reset during an OS update.

What is the goal?
Give access to others? Then sudo is the first choice!
 
Old 12-12-2023, 05:47 PM   #4
NewUser0001
LQ Newbie
 
Registered: Dec 2023
Posts: 3

Original Poster
Rep: Reputation: 0
Appreciate the responses guys,

When I say internal documentation, I mean someone had previously documented this as a process for me to follow when setting up a new machine.
(person has since left) never spoke to him personally, way before my time.

I wanted to understand why he would chown and chgrp to a different user(in this case it was local account with UID1000, which I believe is the user who setup the machine) and then apply chmod 0644 with that user as well.

@madeinGermany - thanks for the tip, yes I read as well that some modules would also complain about the integrity of the passwd/shadow file if permissions were changed.

I might keep it standard as root, especially if its more secure.
 
Old 12-12-2023, 09:31 PM   #5
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,662
Blog Entries: 4

Rep: Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942
Do Not(!) Do This!

Period.
 
1 members found this post helpful.
Old 12-12-2023, 10:39 PM   #6
NewUser0001
LQ Newbie
 
Registered: Dec 2023
Posts: 3

Original Poster
Rep: Reputation: 0
Roger that, thanks LEGENDS.
 
Old 12-13-2023, 12:55 AM   #7
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,864

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
yes, in a production environment do not do this. But in a VM you may try it, if you wish. And you will see the result. Anyway, you need to ask that person about it (or check if it was documented somewhere). It is quite unusual, there is no real reason to do that.
 
Old 12-13-2023, 01:25 AM   #8
___
Member
 
Registered: Apr 2023
Posts: 140
Blog Entries: 1

Rep: Reputation: Disabled
Exclamation Fascinating

Welcome to LQ, NewUser0001 (last time I backwardly said: "Welcome <new username> to LQ", LoL)

Quote:
[x-employee] had previously documented this as a process for me to follow when setting up a new machine
OhMyGosh, I wonder IF they still have/had access! Or maybe they were 'making fun' of a n00b....
(1000 is generally the first added user)

Anyway, +1 #5 (infinitely better/safer to just erase the whole system)

I hope you spend some time studying Linux! Run VirtualBox.org on your PC & start with the .iso of DistroWatch.com/mll
(It is just the kernel & BusyBox.net CLI, withOUT even an /etc/passwd file! Cool!)

Best Wishes (&be careful)! Feel free to ask&tell us more....
 
Old 12-13-2023, 08:05 AM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,662
Blog Entries: 4

Rep: Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942Reputation: 3942
Explanation:

These files are part of the so-called "shadow passwords" system. The original Unix® put lightly-encrypted "actual passwords(!)" in a file called passwd, and this became a still-supported way to obtain a list of all system users. But it was terribly insecure.

So, one way – but not the only way – to properly secure them was to put the "real" information in a "shadow" password-file that ordinary users can't get into. The original passwd file continues to exist and has the same format as before, for application compatibility, but it doesn't contain real passwords. (Likewise the groups file isn't "real" or "authoritative.")

Footnote: Linux provides a system called PAM = Pluggable Authentication Modules which allows you to, among other things, completely supersede the "passwd" system and replace it with something else. For example, many companies use LDAP, or Microsoft's "OpenDirectory®" equivalent of the same, to provide centrally-managed "single sign-on" capability across all their computers at once. And Linux is seamlessly compatible with that, by means of PAM and kernel modules.

Last edited by sundialsvcs; 12-13-2023 at 08:07 AM.
 
  


Reply



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
[SOLVED] .new files for /etc/passwd, /etc/shadow, etc. uiopqwerty Slackware 3 07-20-2020 06:45 AM
[SOLVED] Legacy Account in /etc/passwd, /etc/shadow and/or /etc/group lalit singhania Linux - Newbie 4 06-07-2012 06:33 AM
[SOLVED] /etc/passwd- & /etc/shadow- & /etc/group- Mr. Alex Linux - Newbie 1 12-31-2010 05:19 AM
linking /etc/passwd , group, shadow to SAN storage jamied66 Linux - Server 5 03-27-2009 04:01 PM
/etc/passwd, /etc/shadow, /etc/group? Educate me :)! nutnut Linux - General 4 06-11-2005 07:47 PM

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

All times are GMT -5. The time now is 12:50 AM.

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