hankknight
asked on
Show FTP Users currently logged in
I want to know the usernames and IP addresses of all FTP users currently logged in.
I use vsftpd on CentOS5.
I use vsftpd on CentOS5.
ASKER
Thanks but that shows other usres as well, such as root and nobody who are NOT connected with FTP. I only want the usernames and IP addresses of all FTP users currently logged in to FTP.
who | grep -i ftp
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.
haswandi, your idea returns an empty result even when FTP users are logged in.
pawwa, this just returns 0:00
ps aux | grep vsftpd | grep -v grep | fmt -u | cut -d " " -f 12 | sed -e "s/\(.*\)\/\(.*\):/\1 \2/" | grep "^[[:digit:]]"
haswandi, your idea returns an empty result even when FTP users are logged in.
pawwa, this just returns 0:00
ps aux | grep vsftpd | grep -v grep | fmt -u | cut -d " " -f 12 | sed -e "s/\(.*\)\/\(.*\):/\1 \2/" | grep "^[[:digit:]]"
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hmmm, strange, I've tested yesterday those combined commands on my server, and it has successfully shown the users and their IPs, but you are right the commands are wrong, (because of the fmt -u).
Anyway, I modified the commands, so it should be like this:
# ps aux | grep vsftpd | grep -v grep | tr -s " " | cut -d " " -f 12 | sed -e "s/\(.*\)\/\(.*\):/\1 \2/" | grep "^[[:digit:]]" | grep "[[:alnum:]]$"
I run this as root at it gives me IP USER formatted output.
BTW, haswandi's solution (who | grep -i ftp) is nicer, but I don't know why it won't give you any output (I guess you have setproctitle_enable=YES in your vsftpd.conf?).
Anyway, I modified the commands, so it should be like this:
# ps aux | grep vsftpd | grep -v grep | tr -s " " | cut -d " " -f 12 | sed -e "s/\(.*\)\/\(.*\):/\1 \2/" | grep "^[[:digit:]]" | grep "[[:alnum:]]$"
I run this as root at it gives me IP USER formatted output.
BTW, haswandi's solution (who | grep -i ftp) is nicer, but I don't know why it won't give you any output (I guess you have setproctitle_enable=YES in your vsftpd.conf?).
setproctitle_enable=YES
session_support=YES
Then reload the service:
# service vsftpd reload
and now you can see connected users and their IP addresses with process listing:
# ps aux | grep vsftpd | grep -v grep