Disabling SSH Access For All Users

Dathorn_ADT

Active Member
Nov 16, 2002
41
1
158
cPanel Access Level
Root Administrator
Does anyone have an easy way to disable SSH access for all users that currently have it enabled whether it be regular SSH or jailed SSH? Changing them individually via "Manage Shell Access" is a bit ridiculous when your talking about thousands of accounts.
 

sparek-3

Well-Known Member
Aug 10, 2002
2,039
229
368
cPanel Access Level
Root Administrator
Try:

Code:
for i in `ls -A /var/cpanel/users`; do usermod -s /usr/local/cpanel/bin/noshell $i; done
I haven't tested this, so proceed at your own risk.

Basically this should find a list of all your cpanel users from /var/cpanel/users and then change the shell for all users to /usr/local/cpanel/bin/noshell. It should work, but again, I haven't tested it.