Who has ssh access?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
25 views
As a team view the users which have SSH access?
by | 25 views

2 Answers

0 like 0 dislike
It has access to the users listed in /etc/passwd with a valid shell.
Something like this:
cat /etc/passwd | grep -E '/bin/(bash|sh)$' | grep -Eo '^\\w+'

This is an example for the popular shells (bash and sh), they are all listed in /etc/shells.

UPD: in this version scans all active Shelah in the system (thanks to Boris semov for the comments)
while read SHELL; do cat /etc/passwd | grep -E "$SHELL$" | grep -Eo '^\\w+'; done < /etc/shells
by
0 like 0 dislike
look in /etc/passwd one as the shell specified shell. For example
grep "sh" /etc/passwd
by

Related questions

0 like 0 dislike
3 answers
asked Apr 12, 2019 by html_profi
0 like 0 dislike
3 answers
0 like 0 dislike
2 answers
0 like 0 dislike
3 answers
110,608 questions
257,187 answers
0 comments
40,796 users