How to manage /etc/passwd file
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
Let's say I want to keep the /etc/passwd
file divided into system users like admin
, wheel
, root
etc., and by actual users all at the end.
How do I do that? By creating subdirectories?
files password etc shadow
add a comment |Â
up vote
1
down vote
favorite
Let's say I want to keep the /etc/passwd
file divided into system users like admin
, wheel
, root
etc., and by actual users all at the end.
How do I do that? By creating subdirectories?
files password etc shadow
1
Do you mean/etc/passwd
? What's wrong with using the standard tools? What sort of "managing" of this file would you want to do? Please edit your question to clarifiy what you are actually trying to achieve.
â roaima
Mar 23 at 23:33
hi roaima.... what i was trying to ask is how to keep the /etc/passwd file divided into system users like admin, wheel, root etc and by actual users all at the end. thank you - denny
â Denny
Mar 23 at 23:51
you can always (carefully) edit the file manually and move lines around. new users are appended to the bottom. how often are you adding system users and regular users? If nothing else, you cansort -n -t ':' -k3 /etc/passwd | less
â ivanivan
Mar 24 at 0:19
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Let's say I want to keep the /etc/passwd
file divided into system users like admin
, wheel
, root
etc., and by actual users all at the end.
How do I do that? By creating subdirectories?
files password etc shadow
Let's say I want to keep the /etc/passwd
file divided into system users like admin
, wheel
, root
etc., and by actual users all at the end.
How do I do that? By creating subdirectories?
files password etc shadow
edited Mar 24 at 8:43
Kusalananda
102k13201317
102k13201317
asked Mar 23 at 23:29
Denny
4115
4115
1
Do you mean/etc/passwd
? What's wrong with using the standard tools? What sort of "managing" of this file would you want to do? Please edit your question to clarifiy what you are actually trying to achieve.
â roaima
Mar 23 at 23:33
hi roaima.... what i was trying to ask is how to keep the /etc/passwd file divided into system users like admin, wheel, root etc and by actual users all at the end. thank you - denny
â Denny
Mar 23 at 23:51
you can always (carefully) edit the file manually and move lines around. new users are appended to the bottom. how often are you adding system users and regular users? If nothing else, you cansort -n -t ':' -k3 /etc/passwd | less
â ivanivan
Mar 24 at 0:19
add a comment |Â
1
Do you mean/etc/passwd
? What's wrong with using the standard tools? What sort of "managing" of this file would you want to do? Please edit your question to clarifiy what you are actually trying to achieve.
â roaima
Mar 23 at 23:33
hi roaima.... what i was trying to ask is how to keep the /etc/passwd file divided into system users like admin, wheel, root etc and by actual users all at the end. thank you - denny
â Denny
Mar 23 at 23:51
you can always (carefully) edit the file manually and move lines around. new users are appended to the bottom. how often are you adding system users and regular users? If nothing else, you cansort -n -t ':' -k3 /etc/passwd | less
â ivanivan
Mar 24 at 0:19
1
1
Do you mean
/etc/passwd
? What's wrong with using the standard tools? What sort of "managing" of this file would you want to do? Please edit your question to clarifiy what you are actually trying to achieve.â roaima
Mar 23 at 23:33
Do you mean
/etc/passwd
? What's wrong with using the standard tools? What sort of "managing" of this file would you want to do? Please edit your question to clarifiy what you are actually trying to achieve.â roaima
Mar 23 at 23:33
hi roaima.... what i was trying to ask is how to keep the /etc/passwd file divided into system users like admin, wheel, root etc and by actual users all at the end. thank you - denny
â Denny
Mar 23 at 23:51
hi roaima.... what i was trying to ask is how to keep the /etc/passwd file divided into system users like admin, wheel, root etc and by actual users all at the end. thank you - denny
â Denny
Mar 23 at 23:51
you can always (carefully) edit the file manually and move lines around. new users are appended to the bottom. how often are you adding system users and regular users? If nothing else, you can
sort -n -t ':' -k3 /etc/passwd | less
â ivanivan
Mar 24 at 0:19
you can always (carefully) edit the file manually and move lines around. new users are appended to the bottom. how often are you adding system users and regular users? If nothing else, you can
sort -n -t ':' -k3 /etc/passwd | less
â ivanivan
Mar 24 at 0:19
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
4
down vote
You can edit the file (carefully!) with vipw
. (Don't use an editor directly on the file as vipw
will sanity-check the result before updating /etc/passwd
.) If you want a different editor, such as nano
, you can request that like this:
vipw # Uses default editor
EDITOR=nano vipw # Uses nano as the preferred editor
You can sort the file by ascending order of UID. This will separate system accounts that typically have lower numbers from user accounts that typically have higher numbers:
sort -n -t: -k3,4 /etc/passwd >/etc/passwd.old &&
cp -fp /etc/passwd.old /etc/passwd
(That can be run all on one line if you prefer.) An unchanged copy of the password file is left in /etc/passwd.old
.
add a comment |Â
up vote
3
down vote
UID ranges define system vs. user accounts.
That is unless you are using a global LDAP server or equivalent to manage users & groups which would still conform to the reference but merely extends the ranges.
Typically system accounts or those with a UID less than 100 are system reserved. Applications that create a local entry to assist with privilege escalation problems in the event of a design flaw are 100 - 499. 500 and above are for users.
Typically manual editing of the local passwd database is frowned upon and should be managed with tools such as useradd
, userdel
, passwd
, usermod
etc.
If you are simply looking for a way to audit accounts and want them sorted on output the following bit will work.
sort -d: -k2 /etc/passwd
For persistent sorting, there ispwck -s
andgrpck -s
.
â telcoM
Mar 26 at 21:13
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
You can edit the file (carefully!) with vipw
. (Don't use an editor directly on the file as vipw
will sanity-check the result before updating /etc/passwd
.) If you want a different editor, such as nano
, you can request that like this:
vipw # Uses default editor
EDITOR=nano vipw # Uses nano as the preferred editor
You can sort the file by ascending order of UID. This will separate system accounts that typically have lower numbers from user accounts that typically have higher numbers:
sort -n -t: -k3,4 /etc/passwd >/etc/passwd.old &&
cp -fp /etc/passwd.old /etc/passwd
(That can be run all on one line if you prefer.) An unchanged copy of the password file is left in /etc/passwd.old
.
add a comment |Â
up vote
4
down vote
You can edit the file (carefully!) with vipw
. (Don't use an editor directly on the file as vipw
will sanity-check the result before updating /etc/passwd
.) If you want a different editor, such as nano
, you can request that like this:
vipw # Uses default editor
EDITOR=nano vipw # Uses nano as the preferred editor
You can sort the file by ascending order of UID. This will separate system accounts that typically have lower numbers from user accounts that typically have higher numbers:
sort -n -t: -k3,4 /etc/passwd >/etc/passwd.old &&
cp -fp /etc/passwd.old /etc/passwd
(That can be run all on one line if you prefer.) An unchanged copy of the password file is left in /etc/passwd.old
.
add a comment |Â
up vote
4
down vote
up vote
4
down vote
You can edit the file (carefully!) with vipw
. (Don't use an editor directly on the file as vipw
will sanity-check the result before updating /etc/passwd
.) If you want a different editor, such as nano
, you can request that like this:
vipw # Uses default editor
EDITOR=nano vipw # Uses nano as the preferred editor
You can sort the file by ascending order of UID. This will separate system accounts that typically have lower numbers from user accounts that typically have higher numbers:
sort -n -t: -k3,4 /etc/passwd >/etc/passwd.old &&
cp -fp /etc/passwd.old /etc/passwd
(That can be run all on one line if you prefer.) An unchanged copy of the password file is left in /etc/passwd.old
.
You can edit the file (carefully!) with vipw
. (Don't use an editor directly on the file as vipw
will sanity-check the result before updating /etc/passwd
.) If you want a different editor, such as nano
, you can request that like this:
vipw # Uses default editor
EDITOR=nano vipw # Uses nano as the preferred editor
You can sort the file by ascending order of UID. This will separate system accounts that typically have lower numbers from user accounts that typically have higher numbers:
sort -n -t: -k3,4 /etc/passwd >/etc/passwd.old &&
cp -fp /etc/passwd.old /etc/passwd
(That can be run all on one line if you prefer.) An unchanged copy of the password file is left in /etc/passwd.old
.
edited Mar 24 at 9:36
Kusalananda
102k13201317
102k13201317
answered Mar 24 at 8:19
roaima
39.5k545107
39.5k545107
add a comment |Â
add a comment |Â
up vote
3
down vote
UID ranges define system vs. user accounts.
That is unless you are using a global LDAP server or equivalent to manage users & groups which would still conform to the reference but merely extends the ranges.
Typically system accounts or those with a UID less than 100 are system reserved. Applications that create a local entry to assist with privilege escalation problems in the event of a design flaw are 100 - 499. 500 and above are for users.
Typically manual editing of the local passwd database is frowned upon and should be managed with tools such as useradd
, userdel
, passwd
, usermod
etc.
If you are simply looking for a way to audit accounts and want them sorted on output the following bit will work.
sort -d: -k2 /etc/passwd
For persistent sorting, there ispwck -s
andgrpck -s
.
â telcoM
Mar 26 at 21:13
add a comment |Â
up vote
3
down vote
UID ranges define system vs. user accounts.
That is unless you are using a global LDAP server or equivalent to manage users & groups which would still conform to the reference but merely extends the ranges.
Typically system accounts or those with a UID less than 100 are system reserved. Applications that create a local entry to assist with privilege escalation problems in the event of a design flaw are 100 - 499. 500 and above are for users.
Typically manual editing of the local passwd database is frowned upon and should be managed with tools such as useradd
, userdel
, passwd
, usermod
etc.
If you are simply looking for a way to audit accounts and want them sorted on output the following bit will work.
sort -d: -k2 /etc/passwd
For persistent sorting, there ispwck -s
andgrpck -s
.
â telcoM
Mar 26 at 21:13
add a comment |Â
up vote
3
down vote
up vote
3
down vote
UID ranges define system vs. user accounts.
That is unless you are using a global LDAP server or equivalent to manage users & groups which would still conform to the reference but merely extends the ranges.
Typically system accounts or those with a UID less than 100 are system reserved. Applications that create a local entry to assist with privilege escalation problems in the event of a design flaw are 100 - 499. 500 and above are for users.
Typically manual editing of the local passwd database is frowned upon and should be managed with tools such as useradd
, userdel
, passwd
, usermod
etc.
If you are simply looking for a way to audit accounts and want them sorted on output the following bit will work.
sort -d: -k2 /etc/passwd
UID ranges define system vs. user accounts.
That is unless you are using a global LDAP server or equivalent to manage users & groups which would still conform to the reference but merely extends the ranges.
Typically system accounts or those with a UID less than 100 are system reserved. Applications that create a local entry to assist with privilege escalation problems in the event of a design flaw are 100 - 499. 500 and above are for users.
Typically manual editing of the local passwd database is frowned upon and should be managed with tools such as useradd
, userdel
, passwd
, usermod
etc.
If you are simply looking for a way to audit accounts and want them sorted on output the following bit will work.
sort -d: -k2 /etc/passwd
answered Mar 24 at 9:33
jas-
71038
71038
For persistent sorting, there ispwck -s
andgrpck -s
.
â telcoM
Mar 26 at 21:13
add a comment |Â
For persistent sorting, there ispwck -s
andgrpck -s
.
â telcoM
Mar 26 at 21:13
For persistent sorting, there is
pwck -s
and grpck -s
.â telcoM
Mar 26 at 21:13
For persistent sorting, there is
pwck -s
and grpck -s
.â telcoM
Mar 26 at 21:13
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f433176%2fhow-to-manage-etc-passwd-file%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Do you mean
/etc/passwd
? What's wrong with using the standard tools? What sort of "managing" of this file would you want to do? Please edit your question to clarifiy what you are actually trying to achieve.â roaima
Mar 23 at 23:33
hi roaima.... what i was trying to ask is how to keep the /etc/passwd file divided into system users like admin, wheel, root etc and by actual users all at the end. thank you - denny
â Denny
Mar 23 at 23:51
you can always (carefully) edit the file manually and move lines around. new users are appended to the bottom. how often are you adding system users and regular users? If nothing else, you can
sort -n -t ':' -k3 /etc/passwd | less
â ivanivan
Mar 24 at 0:19