How to output from cli a list of all active FTP user accounts on WHM server
AnsweredHi Team,
I am a little stuck. How can I list ALL FTP accounts on the entire server for security audit to check which accounts have FTP accounts active etc.
I read this and it works
https://api.docs.cpanel.net/openapi/cpanel/operation/list_ftp/
Running the below from the cli works.
uapi --output=jsonpretty \
--user=username \
Ftp \
list_ftp
However would have to replace username with every single user on the server . Is there another script that can output all users FTP accounts like above or similiar. Or has anyone managed to create a loop script that can achieve this.
-
Hey there! As you've mentioned, the best thing to do would be to create a for loop that uses each cPanel username. This works well on a test system, although you'll need to ignore "system" and "nobody" from the output:
for i in `ls /var/cpanel/users`; do uapi --user=$i Ftp list_ftp; done
0 -
cPRex your a legend . did the trick. Can tidy it up a little more to remove "system accounts" and output to a TXT or CSV but for now that worked and got me going. Thanks much appreciated on this.
0 -
I'm glad that helped!
0
Please sign in to leave a comment.
Comments
3 comments