List only local user accounts with a single command Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Trouble authenticating and with groups. Phantom duplicate user account?Find out if there is a local user logged in when logging in over sshUser Accounts not listed in System Settings User AccountsList all non system usersOSSEC user accounts disabledHow to add flags and/or arguments to a command in the 'sudoers' fileGetting rid of an unknown userRemoving user accountsHow to start pulseaudio for all users at startup?LDAP accounts not given same rights/permissions/policies as Local accounts
How do I find out the mythology and history of my Fortress?
Is "Reachable Object" really an NP-complete problem?
What's the meaning of "fortified infraction restraint"?
How do I make this wiring inside cabinet safer? (Pic)
If a contract sometimes uses the wrong name, is it still valid?
Do jazz musicians improvise on the parent scale in addition to the chord-scales?
What are the out-of-universe reasons for the references to Toby Maguire-era Spider-Man in ITSV
Is grep documentation wrong?
Is the Standard Deduction better than Itemized when both are the same amount?
Is it common practice to audition new musicians one-on-one before rehearsing with the entire band?
Significance of Cersei's obsession with elephants?
Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?
Closed form of recurrent arithmetic series summation
Wu formula for manifolds with boundary
What font is "z" in "z-score"?
When a candle burns, why does the top of wick glow if bottom of flame is hottest?
Where are Serre’s lectures at Collège de France to be found?
Do wooden building fires get hotter than 600°C?
Did MS DOS itself ever use blinking text?
Would "destroying" Wurmcoil Engine prevent its tokens from being created?
Why are both D and D# fitting into my E minor key?
Using audio cues to encourage good posture
Generate an RGB colour grid
How does the math work when buying airline miles?
List only local user accounts with a single command
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Trouble authenticating and with groups. Phantom duplicate user account?Find out if there is a local user logged in when logging in over sshUser Accounts not listed in System Settings User AccountsList all non system usersOSSEC user accounts disabledHow to add flags and/or arguments to a command in the 'sudoers' fileGetting rid of an unknown userRemoving user accountsHow to start pulseaudio for all users at startup?LDAP accounts not given same rights/permissions/policies as Local accounts
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I am using Ubuntu 18.04 and I need to list all the user accounts on the computer but not all of the accounts, only the local users.
the command cut -d: -f1 /etc/passwd
gives:
root
daemon
bin
sys
sync
games
...
pulse
avahi
colord
hplip
geoclue
gnome-initial-setup
gdm
esnow
stuartsnow
samsnow
Does anyone know of a command that would output only the local users, for example:
root
esnow
stuartsnow
samsnow
command-line 18.04 users user-management
New contributor
add a comment |
I am using Ubuntu 18.04 and I need to list all the user accounts on the computer but not all of the accounts, only the local users.
the command cut -d: -f1 /etc/passwd
gives:
root
daemon
bin
sys
sync
games
...
pulse
avahi
colord
hplip
geoclue
gnome-initial-setup
gdm
esnow
stuartsnow
samsnow
Does anyone know of a command that would output only the local users, for example:
root
esnow
stuartsnow
samsnow
command-line 18.04 users user-management
New contributor
1
What do you mean by "local users"? All of those are local users. What is the difference between the users you have selected and the others? Why wouldroot
not be included in any list of real users?
– terdon♦
Apr 13 at 11:50
These users are user accounts that you can log into and that are used by real people, rather than just user accounts for the operating system. I'm not sure what the term for that is sorry
– Greer Page
Apr 13 at 11:53
add a comment |
I am using Ubuntu 18.04 and I need to list all the user accounts on the computer but not all of the accounts, only the local users.
the command cut -d: -f1 /etc/passwd
gives:
root
daemon
bin
sys
sync
games
...
pulse
avahi
colord
hplip
geoclue
gnome-initial-setup
gdm
esnow
stuartsnow
samsnow
Does anyone know of a command that would output only the local users, for example:
root
esnow
stuartsnow
samsnow
command-line 18.04 users user-management
New contributor
I am using Ubuntu 18.04 and I need to list all the user accounts on the computer but not all of the accounts, only the local users.
the command cut -d: -f1 /etc/passwd
gives:
root
daemon
bin
sys
sync
games
...
pulse
avahi
colord
hplip
geoclue
gnome-initial-setup
gdm
esnow
stuartsnow
samsnow
Does anyone know of a command that would output only the local users, for example:
root
esnow
stuartsnow
samsnow
command-line 18.04 users user-management
command-line 18.04 users user-management
New contributor
New contributor
edited Apr 13 at 11:53
Greer Page
New contributor
asked Apr 13 at 11:48
Greer PageGreer Page
184
184
New contributor
New contributor
1
What do you mean by "local users"? All of those are local users. What is the difference between the users you have selected and the others? Why wouldroot
not be included in any list of real users?
– terdon♦
Apr 13 at 11:50
These users are user accounts that you can log into and that are used by real people, rather than just user accounts for the operating system. I'm not sure what the term for that is sorry
– Greer Page
Apr 13 at 11:53
add a comment |
1
What do you mean by "local users"? All of those are local users. What is the difference between the users you have selected and the others? Why wouldroot
not be included in any list of real users?
– terdon♦
Apr 13 at 11:50
These users are user accounts that you can log into and that are used by real people, rather than just user accounts for the operating system. I'm not sure what the term for that is sorry
– Greer Page
Apr 13 at 11:53
1
1
What do you mean by "local users"? All of those are local users. What is the difference between the users you have selected and the others? Why would
root
not be included in any list of real users?– terdon♦
Apr 13 at 11:50
What do you mean by "local users"? All of those are local users. What is the difference between the users you have selected and the others? Why would
root
not be included in any list of real users?– terdon♦
Apr 13 at 11:50
These users are user accounts that you can log into and that are used by real people, rather than just user accounts for the operating system. I'm not sure what the term for that is sorry
– Greer Page
Apr 13 at 11:53
These users are user accounts that you can log into and that are used by real people, rather than just user accounts for the operating system. I'm not sure what the term for that is sorry
– Greer Page
Apr 13 at 11:53
add a comment |
1 Answer
1
active
oldest
votes
If you want the list of users that can actually log into the machine, look for the users whose login shell (the last field in /etc/passwd
) is not set to /bin/false
or /sbin/nologin
:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/' /etc/passwd
root:x:0:0:root:/root:/bin/bash
sync:x:4:65534:sync:/bin:/bin/sync
terdon:x:1000:1000::/home/terdon:/bin/bash
git:x:996:996:git daemon user:/:/bin/bash
bib:x:1001:1001::/home/bib:/bin/bash
bob:x:1002:1002::/home/bob:/bin/bash
And to get the user name only:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/print $1' /etc/passwd
root
sync
terdon
git
bib
bob
If you want only "normal" users, those who were created using the standard approach and therefore will have a home directory under /home
, use:
$ awk -F: '$6~//home/' /etc/passwd
syslog:x:101:104::/home/syslog:/bin/false
terdon:x:1000:1000::/home/terdon:/bin/bash
bib:x:1001:1001::/home/bib:/bin/bash
bob:x:1002:1002::/home/bob:/bin/bash
And, for the username only:
$ awk -F: '$6~//home/print $1' /etc/passwd
syslog
terdon
bib
bob
Finally, you can combine the two to get all users with a home in /home
and a valid login shell:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/ && $6~//home/print $1' /etc/passwd
terdon
bib
bob
On a sane Ubuntu system, all of the non-system users should have a user ID between 1000 and 29999. So, assuming you haven't created any user with a lower UID, you could do:
awk -F: '$3>999 && $3<30000print $1' /etc/passwd
And you could combine everything again (some services have regular user IDs but don't have a login shell, jira on my work server, for instance):
awk -F: '$3>999 && $3<30000 && $NF!~//false$/ && $NF!~//nologin$/ && $6~//home/print $1' /etc/passwd
Thanks for the answer! I just have one quick question, when usingawk -F: '$6~//home/print $1' /etc/passwd
I get the expected output except I get the userssyslog
and ` cups-pk-helper` do you know what these users are?
– Greer Page
Apr 13 at 12:15
@GreerPage they're the user used to run the syslog (system log) service and cups (printing) services, presumably. My bad, I tested this command on an Arch system, not Ubuntu, and arch doesn't give those home directories in/home
. I added an approach combining the two original approaches which should filter those two users out. However, note that these are all real, local users. I think you are assuming a functional difference between saysyslog
and your own user which simply doesn't exist.
– terdon♦
Apr 13 at 12:22
Okay, I am sorry for the confusing question I don't know a lot of the vocabulary yet, but, thanks for the answer and helping me understand!
– Greer Page
Apr 13 at 12:27
A better test would perhaps be UID. UID 0-999 means system account on Debian and Ubuntu, while >1000 means normal user.
– vidarlo
Apr 13 at 12:31
@GreerPage no reason to apologize! My first comments about local users wasn't telling you off, I was just trying to understand what you were after (you can have non-local users when using systems like LDAP for example). And again, my last comment here was just to let you know that you might be laboring under a misapprehension since there is no effective difference between your user and system users other than the ones I listed here, really.
– terdon♦
Apr 13 at 12:31
|
show 3 more comments
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Greer Page is a new contributor. Be nice, and check out our Code of Conduct.
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1133515%2flist-only-local-user-accounts-with-a-single-command%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you want the list of users that can actually log into the machine, look for the users whose login shell (the last field in /etc/passwd
) is not set to /bin/false
or /sbin/nologin
:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/' /etc/passwd
root:x:0:0:root:/root:/bin/bash
sync:x:4:65534:sync:/bin:/bin/sync
terdon:x:1000:1000::/home/terdon:/bin/bash
git:x:996:996:git daemon user:/:/bin/bash
bib:x:1001:1001::/home/bib:/bin/bash
bob:x:1002:1002::/home/bob:/bin/bash
And to get the user name only:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/print $1' /etc/passwd
root
sync
terdon
git
bib
bob
If you want only "normal" users, those who were created using the standard approach and therefore will have a home directory under /home
, use:
$ awk -F: '$6~//home/' /etc/passwd
syslog:x:101:104::/home/syslog:/bin/false
terdon:x:1000:1000::/home/terdon:/bin/bash
bib:x:1001:1001::/home/bib:/bin/bash
bob:x:1002:1002::/home/bob:/bin/bash
And, for the username only:
$ awk -F: '$6~//home/print $1' /etc/passwd
syslog
terdon
bib
bob
Finally, you can combine the two to get all users with a home in /home
and a valid login shell:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/ && $6~//home/print $1' /etc/passwd
terdon
bib
bob
On a sane Ubuntu system, all of the non-system users should have a user ID between 1000 and 29999. So, assuming you haven't created any user with a lower UID, you could do:
awk -F: '$3>999 && $3<30000print $1' /etc/passwd
And you could combine everything again (some services have regular user IDs but don't have a login shell, jira on my work server, for instance):
awk -F: '$3>999 && $3<30000 && $NF!~//false$/ && $NF!~//nologin$/ && $6~//home/print $1' /etc/passwd
Thanks for the answer! I just have one quick question, when usingawk -F: '$6~//home/print $1' /etc/passwd
I get the expected output except I get the userssyslog
and ` cups-pk-helper` do you know what these users are?
– Greer Page
Apr 13 at 12:15
@GreerPage they're the user used to run the syslog (system log) service and cups (printing) services, presumably. My bad, I tested this command on an Arch system, not Ubuntu, and arch doesn't give those home directories in/home
. I added an approach combining the two original approaches which should filter those two users out. However, note that these are all real, local users. I think you are assuming a functional difference between saysyslog
and your own user which simply doesn't exist.
– terdon♦
Apr 13 at 12:22
Okay, I am sorry for the confusing question I don't know a lot of the vocabulary yet, but, thanks for the answer and helping me understand!
– Greer Page
Apr 13 at 12:27
A better test would perhaps be UID. UID 0-999 means system account on Debian and Ubuntu, while >1000 means normal user.
– vidarlo
Apr 13 at 12:31
@GreerPage no reason to apologize! My first comments about local users wasn't telling you off, I was just trying to understand what you were after (you can have non-local users when using systems like LDAP for example). And again, my last comment here was just to let you know that you might be laboring under a misapprehension since there is no effective difference between your user and system users other than the ones I listed here, really.
– terdon♦
Apr 13 at 12:31
|
show 3 more comments
If you want the list of users that can actually log into the machine, look for the users whose login shell (the last field in /etc/passwd
) is not set to /bin/false
or /sbin/nologin
:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/' /etc/passwd
root:x:0:0:root:/root:/bin/bash
sync:x:4:65534:sync:/bin:/bin/sync
terdon:x:1000:1000::/home/terdon:/bin/bash
git:x:996:996:git daemon user:/:/bin/bash
bib:x:1001:1001::/home/bib:/bin/bash
bob:x:1002:1002::/home/bob:/bin/bash
And to get the user name only:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/print $1' /etc/passwd
root
sync
terdon
git
bib
bob
If you want only "normal" users, those who were created using the standard approach and therefore will have a home directory under /home
, use:
$ awk -F: '$6~//home/' /etc/passwd
syslog:x:101:104::/home/syslog:/bin/false
terdon:x:1000:1000::/home/terdon:/bin/bash
bib:x:1001:1001::/home/bib:/bin/bash
bob:x:1002:1002::/home/bob:/bin/bash
And, for the username only:
$ awk -F: '$6~//home/print $1' /etc/passwd
syslog
terdon
bib
bob
Finally, you can combine the two to get all users with a home in /home
and a valid login shell:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/ && $6~//home/print $1' /etc/passwd
terdon
bib
bob
On a sane Ubuntu system, all of the non-system users should have a user ID between 1000 and 29999. So, assuming you haven't created any user with a lower UID, you could do:
awk -F: '$3>999 && $3<30000print $1' /etc/passwd
And you could combine everything again (some services have regular user IDs but don't have a login shell, jira on my work server, for instance):
awk -F: '$3>999 && $3<30000 && $NF!~//false$/ && $NF!~//nologin$/ && $6~//home/print $1' /etc/passwd
Thanks for the answer! I just have one quick question, when usingawk -F: '$6~//home/print $1' /etc/passwd
I get the expected output except I get the userssyslog
and ` cups-pk-helper` do you know what these users are?
– Greer Page
Apr 13 at 12:15
@GreerPage they're the user used to run the syslog (system log) service and cups (printing) services, presumably. My bad, I tested this command on an Arch system, not Ubuntu, and arch doesn't give those home directories in/home
. I added an approach combining the two original approaches which should filter those two users out. However, note that these are all real, local users. I think you are assuming a functional difference between saysyslog
and your own user which simply doesn't exist.
– terdon♦
Apr 13 at 12:22
Okay, I am sorry for the confusing question I don't know a lot of the vocabulary yet, but, thanks for the answer and helping me understand!
– Greer Page
Apr 13 at 12:27
A better test would perhaps be UID. UID 0-999 means system account on Debian and Ubuntu, while >1000 means normal user.
– vidarlo
Apr 13 at 12:31
@GreerPage no reason to apologize! My first comments about local users wasn't telling you off, I was just trying to understand what you were after (you can have non-local users when using systems like LDAP for example). And again, my last comment here was just to let you know that you might be laboring under a misapprehension since there is no effective difference between your user and system users other than the ones I listed here, really.
– terdon♦
Apr 13 at 12:31
|
show 3 more comments
If you want the list of users that can actually log into the machine, look for the users whose login shell (the last field in /etc/passwd
) is not set to /bin/false
or /sbin/nologin
:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/' /etc/passwd
root:x:0:0:root:/root:/bin/bash
sync:x:4:65534:sync:/bin:/bin/sync
terdon:x:1000:1000::/home/terdon:/bin/bash
git:x:996:996:git daemon user:/:/bin/bash
bib:x:1001:1001::/home/bib:/bin/bash
bob:x:1002:1002::/home/bob:/bin/bash
And to get the user name only:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/print $1' /etc/passwd
root
sync
terdon
git
bib
bob
If you want only "normal" users, those who were created using the standard approach and therefore will have a home directory under /home
, use:
$ awk -F: '$6~//home/' /etc/passwd
syslog:x:101:104::/home/syslog:/bin/false
terdon:x:1000:1000::/home/terdon:/bin/bash
bib:x:1001:1001::/home/bib:/bin/bash
bob:x:1002:1002::/home/bob:/bin/bash
And, for the username only:
$ awk -F: '$6~//home/print $1' /etc/passwd
syslog
terdon
bib
bob
Finally, you can combine the two to get all users with a home in /home
and a valid login shell:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/ && $6~//home/print $1' /etc/passwd
terdon
bib
bob
On a sane Ubuntu system, all of the non-system users should have a user ID between 1000 and 29999. So, assuming you haven't created any user with a lower UID, you could do:
awk -F: '$3>999 && $3<30000print $1' /etc/passwd
And you could combine everything again (some services have regular user IDs but don't have a login shell, jira on my work server, for instance):
awk -F: '$3>999 && $3<30000 && $NF!~//false$/ && $NF!~//nologin$/ && $6~//home/print $1' /etc/passwd
If you want the list of users that can actually log into the machine, look for the users whose login shell (the last field in /etc/passwd
) is not set to /bin/false
or /sbin/nologin
:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/' /etc/passwd
root:x:0:0:root:/root:/bin/bash
sync:x:4:65534:sync:/bin:/bin/sync
terdon:x:1000:1000::/home/terdon:/bin/bash
git:x:996:996:git daemon user:/:/bin/bash
bib:x:1001:1001::/home/bib:/bin/bash
bob:x:1002:1002::/home/bob:/bin/bash
And to get the user name only:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/print $1' /etc/passwd
root
sync
terdon
git
bib
bob
If you want only "normal" users, those who were created using the standard approach and therefore will have a home directory under /home
, use:
$ awk -F: '$6~//home/' /etc/passwd
syslog:x:101:104::/home/syslog:/bin/false
terdon:x:1000:1000::/home/terdon:/bin/bash
bib:x:1001:1001::/home/bib:/bin/bash
bob:x:1002:1002::/home/bob:/bin/bash
And, for the username only:
$ awk -F: '$6~//home/print $1' /etc/passwd
syslog
terdon
bib
bob
Finally, you can combine the two to get all users with a home in /home
and a valid login shell:
$ awk -F: '$NF!~//false$/ && $NF!~//nologin$/ && $6~//home/print $1' /etc/passwd
terdon
bib
bob
On a sane Ubuntu system, all of the non-system users should have a user ID between 1000 and 29999. So, assuming you haven't created any user with a lower UID, you could do:
awk -F: '$3>999 && $3<30000print $1' /etc/passwd
And you could combine everything again (some services have regular user IDs but don't have a login shell, jira on my work server, for instance):
awk -F: '$3>999 && $3<30000 && $NF!~//false$/ && $NF!~//nologin$/ && $6~//home/print $1' /etc/passwd
edited Apr 13 at 12:37
answered Apr 13 at 11:58
terdon♦terdon
67.9k13140223
67.9k13140223
Thanks for the answer! I just have one quick question, when usingawk -F: '$6~//home/print $1' /etc/passwd
I get the expected output except I get the userssyslog
and ` cups-pk-helper` do you know what these users are?
– Greer Page
Apr 13 at 12:15
@GreerPage they're the user used to run the syslog (system log) service and cups (printing) services, presumably. My bad, I tested this command on an Arch system, not Ubuntu, and arch doesn't give those home directories in/home
. I added an approach combining the two original approaches which should filter those two users out. However, note that these are all real, local users. I think you are assuming a functional difference between saysyslog
and your own user which simply doesn't exist.
– terdon♦
Apr 13 at 12:22
Okay, I am sorry for the confusing question I don't know a lot of the vocabulary yet, but, thanks for the answer and helping me understand!
– Greer Page
Apr 13 at 12:27
A better test would perhaps be UID. UID 0-999 means system account on Debian and Ubuntu, while >1000 means normal user.
– vidarlo
Apr 13 at 12:31
@GreerPage no reason to apologize! My first comments about local users wasn't telling you off, I was just trying to understand what you were after (you can have non-local users when using systems like LDAP for example). And again, my last comment here was just to let you know that you might be laboring under a misapprehension since there is no effective difference between your user and system users other than the ones I listed here, really.
– terdon♦
Apr 13 at 12:31
|
show 3 more comments
Thanks for the answer! I just have one quick question, when usingawk -F: '$6~//home/print $1' /etc/passwd
I get the expected output except I get the userssyslog
and ` cups-pk-helper` do you know what these users are?
– Greer Page
Apr 13 at 12:15
@GreerPage they're the user used to run the syslog (system log) service and cups (printing) services, presumably. My bad, I tested this command on an Arch system, not Ubuntu, and arch doesn't give those home directories in/home
. I added an approach combining the two original approaches which should filter those two users out. However, note that these are all real, local users. I think you are assuming a functional difference between saysyslog
and your own user which simply doesn't exist.
– terdon♦
Apr 13 at 12:22
Okay, I am sorry for the confusing question I don't know a lot of the vocabulary yet, but, thanks for the answer and helping me understand!
– Greer Page
Apr 13 at 12:27
A better test would perhaps be UID. UID 0-999 means system account on Debian and Ubuntu, while >1000 means normal user.
– vidarlo
Apr 13 at 12:31
@GreerPage no reason to apologize! My first comments about local users wasn't telling you off, I was just trying to understand what you were after (you can have non-local users when using systems like LDAP for example). And again, my last comment here was just to let you know that you might be laboring under a misapprehension since there is no effective difference between your user and system users other than the ones I listed here, really.
– terdon♦
Apr 13 at 12:31
Thanks for the answer! I just have one quick question, when using
awk -F: '$6~//home/print $1' /etc/passwd
I get the expected output except I get the users syslog
and ` cups-pk-helper` do you know what these users are?– Greer Page
Apr 13 at 12:15
Thanks for the answer! I just have one quick question, when using
awk -F: '$6~//home/print $1' /etc/passwd
I get the expected output except I get the users syslog
and ` cups-pk-helper` do you know what these users are?– Greer Page
Apr 13 at 12:15
@GreerPage they're the user used to run the syslog (system log) service and cups (printing) services, presumably. My bad, I tested this command on an Arch system, not Ubuntu, and arch doesn't give those home directories in
/home
. I added an approach combining the two original approaches which should filter those two users out. However, note that these are all real, local users. I think you are assuming a functional difference between say syslog
and your own user which simply doesn't exist.– terdon♦
Apr 13 at 12:22
@GreerPage they're the user used to run the syslog (system log) service and cups (printing) services, presumably. My bad, I tested this command on an Arch system, not Ubuntu, and arch doesn't give those home directories in
/home
. I added an approach combining the two original approaches which should filter those two users out. However, note that these are all real, local users. I think you are assuming a functional difference between say syslog
and your own user which simply doesn't exist.– terdon♦
Apr 13 at 12:22
Okay, I am sorry for the confusing question I don't know a lot of the vocabulary yet, but, thanks for the answer and helping me understand!
– Greer Page
Apr 13 at 12:27
Okay, I am sorry for the confusing question I don't know a lot of the vocabulary yet, but, thanks for the answer and helping me understand!
– Greer Page
Apr 13 at 12:27
A better test would perhaps be UID. UID 0-999 means system account on Debian and Ubuntu, while >1000 means normal user.
– vidarlo
Apr 13 at 12:31
A better test would perhaps be UID. UID 0-999 means system account on Debian and Ubuntu, while >1000 means normal user.
– vidarlo
Apr 13 at 12:31
@GreerPage no reason to apologize! My first comments about local users wasn't telling you off, I was just trying to understand what you were after (you can have non-local users when using systems like LDAP for example). And again, my last comment here was just to let you know that you might be laboring under a misapprehension since there is no effective difference between your user and system users other than the ones I listed here, really.
– terdon♦
Apr 13 at 12:31
@GreerPage no reason to apologize! My first comments about local users wasn't telling you off, I was just trying to understand what you were after (you can have non-local users when using systems like LDAP for example). And again, my last comment here was just to let you know that you might be laboring under a misapprehension since there is no effective difference between your user and system users other than the ones I listed here, really.
– terdon♦
Apr 13 at 12:31
|
show 3 more comments
Greer Page is a new contributor. Be nice, and check out our Code of Conduct.
Greer Page is a new contributor. Be nice, and check out our Code of Conduct.
Greer Page is a new contributor. Be nice, and check out our Code of Conduct.
Greer Page is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1133515%2flist-only-local-user-accounts-with-a-single-command%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
What do you mean by "local users"? All of those are local users. What is the difference between the users you have selected and the others? Why would
root
not be included in any list of real users?– terdon♦
Apr 13 at 11:50
These users are user accounts that you can log into and that are used by real people, rather than just user accounts for the operating system. I'm not sure what the term for that is sorry
– Greer Page
Apr 13 at 11:53