SSH User List

Chris Worner

Well-known member
Registered
Joined
Apr 15, 2016
Messages
612
Points
28
Can anyone tell me what is the SSH command to show/list all user accounts that having on a VPS or a dedicated server? Basically, I wanted to see all logins that can access the box via SSH.
 

LJSHost

Well-known member
Hosting Provider
Registered
Joined
Jul 5, 2016
Messages
1,031
Points
63
Code:
cat /etc/passwd | egrep '(bash|jailshell)'
This will give you a list of accounts that have bash or jailedshell access, you can add other types of shell to the command.
 

djsmiley2k

Well-known member
Registered
Joined
Jul 10, 2016
Messages
198
Points
18
djsmiley2k
I tried to run this command and it works as well not only for Centos but Ubuntu

root@vps150207:~# cat /etc/passwd | egrep '(bash|jailshell)'
root:x:0:0:root:/root:/bin/bash
ubuntu:x:1000:1000:Ubuntu:/home/ubuntu:/bin/bash

Thanks for sharing!
 

hfav

Active member
Registered
Hosting Provider
Joined
Jan 18, 2017
Messages
83
Points
8
You can remove access using following command

HTML:
usermod -s /sbin/nologin username
 
Older Threads
Replies
2
Views
3,952
Replies
5
Views
5,706
Replies
10
Views
11,829
Replies
9
Views
11,966
Newer Threads
Replies
8
Views
12,391
Replies
26
Views
33,178
Replies
7
Views
5,604
Replies
5
Views
4,658
Replies
9
Views
14,611
Latest Threads
Replies
1
Views
1,317
Replies
3
Views
1,088
Replies
1
Views
680
Replies
2
Views
1,271
Replies
1
Views
851
Recommended Threads
Replies
15
Views
8,558
Replies
4
Views
4,618
Replies
19
Views
11,058

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top