{"id":25078,"date":"2021-09-09T23:38:20","date_gmt":"2021-09-09T16:38:20","guid":{"rendered":"https:\/\/doc.bnix.vn\/?p=25078"},"modified":"2022-08-14T07:05:42","modified_gmt":"2022-08-14T00:05:42","slug":"1-so-cau-lenh-thuong-su-dung-tren-csf-ssh-command-line-commands-csf-cheat-sheet","status":"publish","type":"post","link":"https:\/\/doc.bnix.vn\/1-so-cau-lenh-thuong-su-dung-tren-csf-ssh-command-line-commands-csf-cheat-sheet\/","title":{"rendered":"1 s\u1ed1 c\u00e2u l\u1ec7nh th\u01b0\u1eddng s\u1eed d\u1ee5ng tr\u00ean CSF SSH Command Line Commands (CSF Cheat Sheet)"},"content":{"rendered":"\n\n
\n \n
\n \n
\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n <\/div>\n \n
\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n
\n \n\n
<\/div>\n <\/div>\n <\/div>\n<\/div>\n \n\n
\n 4\/5 - (1 b\u00ecnh ch\u1ecdn) <\/div>\n <\/div>\n

B\u00e0i vi\u1ebft n\u00e0y tr\u00ecnh b\u00e0y m\u1ed9t s\u1ed1 l\u1ec7nh d\u00f2ng l\u1ec7nh SSH c\u1ea5u h\u00ecnh m\u00e1y ch\u1ee7 c\u1ea5u h\u00ecnh (CSF) h\u1eefu \u00edch.<\/p>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Command<\/th>\nDescription<\/th>\nExample<\/th>\n<\/tr>\n
csf -e<\/td>\nEnable CSF (B\u1eadt CSF)<\/td>\nroot@server[~]#csf -e<\/td>\n<\/tr>\n
csf -x<\/td>\nDisable CSF (T\u1eaft CSF)<\/td>\nroot@server[~]#csf -x<\/td>\n<\/tr>\n
csf -s<\/td>\nStart the firewall rules (B\u1eaft \u0111\u1ea7u c\u00e1c quy t\u1eafc t\u01b0\u1eddng l\u1eeda)<\/em><\/td>\nroot@server[~]#csf -s<\/td>\n<\/tr>\n
csf -f<\/td>\nFlush\/Stop firewall rules (note: lfd may restart csf)
\n<\/em><\/td>\n
root@server[~]#csf -f<\/td>\n<\/tr>\n
csf -r<\/td>\nRestart the firewall rules (Kh\u1edfi \u0111\u1ed9ng l\u1ea1i t\u01b0\u1eddng l\u1eeda)<\/em><\/td>\nroot@server[~]#csf -r<\/td>\n<\/tr>\n
csf -a [IP.add.re.ss]\u00a0[Optional comment]<\/td>\nAllow an IP and add to \/etc\/csf\/csf.allow (Cho ph\u00e9p 1 IP kh\u1ecfi t\u01b0\u1eddng l\u1eeda)
\n<\/em><\/td>\n
root@server[~]#csf -a 187.33.3.3 Home IP Address<\/td>\n<\/tr>\n
csf -td [IP.add.re.ss] [Optional comment]<\/td>\nPlace an IP on the temporary deny list in \/var\/lib\/csf\/csf.tempban (\u0110\u1eb7t m\u1ed9t IP v\u00e0o danh s\u00e1ch t\u1eeb ch\u1ed1i t\u1ea1m th\u1eddi)<\/td>\nroot@server[~]#csf -td 55.55.55.55 Odd traffic patterns<\/td>\n<\/tr>\n
csf -tr [IP.add.re.ss]<\/td>\nRemove an IP from the temporary IP ban or allow list. (X\u00f3a IP kh\u1ecfi l\u1ec7nh c\u1ea5m t\u1ea1m th\u1eddi ho\u1eb7c danh s\u00e1ch cho ph\u00e9p)
\n<\/em><\/td>\n
root@server[~]#csf -tr 66.192.23.1<\/td>\n<\/tr>\n
csf -tf<\/td>\nFlush all IPs from the temporary IP entries (X\u00f3a t\u1ea5t c\u1ea3 IP t\u1eeb c\u00e1c m\u1ee5c IP t\u1ea1m th\u1eddi)
\n<\/em><\/td>\n
root@server[~]#csf -tf<\/td>\n<\/tr>\n
csf -d [IP.add.re.ss]\u00a0[Optional comment]<\/td>\nDeny an IP and add to \/etc\/csf\/csf.deny (T\u1eeb ch\u1ed1i m\u1ed9t IP v\u00e0 th\u00eam v\u00e0o \/etc\/csf\/csf.deny)<\/em><\/td>\nroot@server[~]#csf -d 66.192.23.1 Blocked This Guy<\/td>\n<\/tr>\n
csf -dr [IP.add.re.ss]<\/td>\nUnblock an IP and remove from \/etc\/csf\/csf.deny (B\u1ecf ch\u1eb7n m\u1ed9t IP v\u00e0 x\u00f3a kh\u1ecfi \/etc\/csf\/csf.deny)<\/em><\/td>\nroot@server[~]#csf -dr 66.192.23.1<\/td>\n<\/tr>\n
csf -df<\/td>\nRemove and unblock all entries in \/etc\/csf\/csf.deny (X\u00f3a v\u00e0 b\u1ecf ch\u1eb7n t\u1ea5t c\u1ea3 c\u00e1c m\u1ee5c)<\/em><\/td>\nroot@server[~]#csf -df<\/td>\n<\/tr>\n
csf -g [IP.add.re.ss]<\/td>\nSearch the iptables and ip6tables rules for a match (e.g. IP, CIDR, Port Number)<\/em><\/td>\nroot@server[~]#csf -g 66.192.23.1<\/td>\n<\/tr>\n
csf -t<\/td>\n\u00a0Displays the current list of temporary allow and deny IP entries with their TTL and comments<\/td>\n\u00a0root@server[~]#csf -t<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

Ch\u00fac c\u00e1c b\u1ea1n th\u00e0nh c\u00f4ng.<\/p>\n","protected":false},"excerpt":{"rendered":"

B\u00e0i vi\u1ebft n\u00e0y tr\u00ecnh b\u00e0y m\u1ed9t s\u1ed1 l\u1ec7nh d\u00f2ng l\u1ec7nh SSH c\u1ea5u h\u00ecnh m\u00e1y ch\u1ee7…<\/p>\n","protected":false},"author":3,"featured_media":25076,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[49],"tags":[61,62],"class_list":["post-25078","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","tag-csf-firewall","tag-tuong-lua"],"_links":{"self":[{"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/posts\/25078","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/comments?post=25078"}],"version-history":[{"count":0,"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/posts\/25078\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/media\/25076"}],"wp:attachment":[{"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/media?parent=25078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/categories?post=25078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/doc.bnix.vn\/wp-json\/wp\/v2\/tags?post=25078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}