LinuxQuestions.org
Help answer threads with 0 replies.
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 02-15-2018, 01:04 AM   #1
Sumitaby1
LQ Newbie
 
Registered: Feb 2018
Posts: 1

Rep: Reputation: Disabled
Listing only the looged username


i want to print the username of the users that can only log in into the system not all the users not the system users.. and i want to do it through the java code as i want it in my project how can we do that?
 
Old 02-15-2018, 08:16 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You don't say what you use for "login" users. Is it /etc/passwd? NIS? LDAP?

Assuming /etc/passwd you can look at various fields to determine information about the users.

Type "man 5 passwd" to see the man page that describes the password file for what the various fields contain.

"system" users are usually those below UID 500 but this isn't guaranteed. Some "system" users (most notably "root") can also login. You might try excluding any user that has "/sbin/nologin" for the shell field. There is no hard an fast rule for "login" vs "system" user. It depends much on what you define.
 
Old 02-15-2018, 09:14 AM   #3
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by Sumitaby1 View Post
i want to print the username of the users that can only log in into the system not all the users not the system users.. and i want to do it through the java code as i want it in my project how can we do that?
I love your use of the English language. Providing you do something other then voice your wants.

google key phrase
"java parse passwd file Linux system" brought up some interesting methods.

Good Luck!

Last edited by BW-userx; 02-15-2018 at 09:17 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
sftp ls command, short listing vs long listing slufoot80 Linux - General 3 02-05-2013 10:40 AM
I made a mistake changing my /home/username/pubIic_html/ ownership to username:user Sionek2u Linux - Newbie 5 06-20-2012 10:30 AM
[SOLVED] Strip that checks if added username can be a username robertjinx Linux - Server 5 11-30-2010 01:51 AM
External HD not initializing until looged in as root cavingman Linux - Hardware 1 02-18-2009 07:01 PM
fedora 8 asking username but during installation i dint give any username ?? herevenku Linux - Newbie 2 08-25-2008 04:37 AM

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

All times are GMT -5. The time now is 10:01 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