首页 文章 精选 留言 我的

精选列表

搜索[服务器],共10000篇文章
优秀的个人博客,低调大师

阿里云服务器CentOS 7.3 64位部署FTP服务

一、安装vsftpd yum -y install vsftpd 二、配置 vsftpd的配置文件在/etc/vsftpd,其中vsftp.conf文件是住配置文件,打开如下: # Example config file /etc/vsftpd/vsftpd.conf # # The default compiled in settings are fairly paranoid. This sample file # loosens things up a bit, to make the ftp daemon more usable. # Please see vsftpd.conf.5 for all compiled in defaults. # # READ THIS: This example file is NOT an exhaustive list of vsftpd options. # Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's # capabilities. # # Allow anonymous FTP? (Beware - allowed by default if you comment this out). # 匿名访问,NO关闭,默认为YES开启状态 anonymous_enable=NO # # Uncomment this to allow local users to log in. # When SELinux is enforcing check for SE bool ftp_home_dir local_enable=YES # # Uncomment this to enable any form of FTP write command. write_enable=YES # # Default umask for local users is 077. You may wish to change this to 022, # if your users expect that (022 is used by most other ftpd's) local_umask=022 # # Uncomment this to allow the anonymous FTP user to upload files. This only # has an effect if the above global write enable is activated. Also, you will # obviously need to create a directory writable by the FTP user. # When SELinux is enforcing check for SE bool allow_ftpd_anon_write, allow_ftpd_full_access #anon_upload_enable=YES # # Uncomment this if you want the anonymous FTP user to be able to create # new directories. #anon_mkdir_write_enable=YES # # Activate directory messages - messages given to remote users when they # go into a certain directory. dirmessage_enable=YES # # Activate logging of uploads/downloads. xferlog_enable=YES # # Make sure PORT transfer connections originate from port 20 (ftp-data). connect_from_port_20=YES # # If you want, you can arrange for uploaded anonymous files to be owned by # a different user. Note! Using "root" for uploaded files is not # recommended! #chown_uploads=YES #chown_username=whoever # # You may override where the log file goes if you like. The default is shown # below. #xferlog_file=/var/log/xferlog # # If you want, you can have your log file in standard ftpd xferlog format. # Note that the default log file location is /var/log/xferlog in this case. xferlog_std_format=YES # # You may change the default value for timing out an idle session. #idle_session_timeout=600 # # You may change the default value for timing out a data connection. #data_connection_timeout=120 # # It is recommended that you define on your system a unique user which the # ftp server can use as a totally isolated and unprivileged user. #nopriv_user=ftpsecure # # Enable this and the server will recognise asynchronous ABOR requests. Not # recommended for security (the code is non-trivial). Not enabling it, # however, may confuse older FTP clients. #async_abor_enable=YES # # By default the server will pretend to allow ASCII mode but in fact ignore # the request. Turn on the below options to have the server actually do ASCII # mangling on files when in ASCII mode. # Beware that on some FTP servers, ASCII support allows a denial of service # attack (DoS) via the command "SIZE /big/file" in ASCII mode. vsftpd # predicted this attack and has always been safe, reporting the size of the # raw file. # ASCII mangling is a horrible feature of the protocol. #ascii_upload_enable=YES #ascii_download_enable=YES # # You may fully customise the login banner string: #ftpd_banner=Welcome to blah FTP service. # # You may specify a file of disallowed anonymous e-mail addresses. Apparently # useful for combatting certain DoS attacks. #deny_email_enable=YES # (default follows) #banned_email_file=/etc/vsftpd/banned_emails # # You may specify an explicit list of local users to chroot() to their home # directory. If chroot_local_user is YES, then this list becomes a list of # users to NOT chroot(). # (Warning! chroot'ing can be very dangerous. If using chroot, make sure that # the user does not have write access to the top level directory within the # chroot) #chroot_local_user=YES #chroot_list_enable=YES # (default follows) #chroot_list_file=/etc/vsftpd/chroot_list # # You may activate the "-R" option to the builtin ls. This is disabled by # default to avoid remote users being able to cause excessive I/O on large # sites. However, some broken FTP clients such as "ncftp" and "mirror" assume # the presence of the "-R" option, so there is a strong case for enabling it. #ls_recurse_enable=YES # # When "listen" directive is enabled, vsftpd runs in standalone mode and # listens on IPv4 sockets. This directive cannot be used in conjunction # with the listen_ipv6 directive. listen=NO # # This directive enables listening on IPv6 sockets. By default, listening # on the IPv6 "any" address (::) will accept connections from both IPv6 # and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6 # sockets. If you want that (perhaps because you want to listen on specific # addresses) then you must run two copies of vsftpd with two configuration # files. # Make sure, that one of the listen options is commented !! listen_ipv6=YES pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES # FTP跟路径设置 local_root=/home 理论上什么都不用修改就可以,但是实际上,我们都会把匿名访问给关闭,和设置一个FTP根路径 anonymous_enable=NO YES改为NO 添加local_root=/home 等号后面为想要设置的文件路径 三、添加用户 useradd ftpadmin -s /sbin/nologin // ftpadmin可改为你的FTP账号 passwd ftpadmin // 设置密码,输入两遍,密码不可见 chown -R ftpadmin /var/ftp // 改动用户权限,格式为chown -R 用户名 文件路径 四、开启服务 service vsftpd start 附:这篇就先这样,以后再更新卸载,vsftpd主配置文件修改及介绍,黑白名单,制定用户配置权限等等

优秀的个人博客,低调大师

服务器架构之性能扩展-第七章(8)

第七章Cacti系统监控邮件报警和压力测试 7.1 Cacti工作原理 原理简单来说,Cacti就是rrdtool的一个forefront,它内置了快速的获数据取工具、优秀的绘图模板以及许多设计精良的数据获取脚本,从而可以通过结合rrdtool强大的数据抓取、数据存储和绘图功能,轻松实现主机负载、网络流量等信息的走势图的绘制。 Cacti的安装: Cacti是建立在lamp环境下的,先建立lamp环境和编译环境。 Yum install pango pango-devel freetype freetype-devel libpng libpng-devel gettext gettext-devel libjpeg libjpeg-devel gd gd-devel libxml2 libxml2-devel libiconv libiconv-devel qpixman qpixman-devel glib glib-devel cairo cairo-devel libart* 7.2部署cacti 1. 安装 rrdtool 源码包 Tar zxvf rrdtool-1.4.5.tar.gz Cd rrdtool-1.4.5 ./configure –prefix=/usr/local Make && make install 2. 安装 snmp 协议 监控协议:SNMP(simple network manager protocol) Yumintall net-snmp* Vi /etc/snmp/snmpd.conf Service snmpd restart 3. 安装 cacti 源码包 Tar zxvf cacti-0.8.7h-beta3.tar.gz Mv cact-0.8.7h-beta3/ /usr/local/apache2/htdocs/cacti/ Vi /usr/local./apache2/conf/httpd.conf 设置网站程序用户,然后重启apache,进程生效 Setfacl –m u:apache:rwx –R htdocs/ Setfacl –m d:u:apache:rwx –R htdocs///修改文件属性值 Getfacl htdocs/ // 查看 htdocs 属性 4. 建立测试数据库 Mysql>create database cacti; Shell#mysql cacti < /usr/local/apache2/htdocs/cacti/caci.sql Mysql>use cacti; Mysql>show tables; 5. 编辑 cacti 配置文件 Vi /usr/local/apache2/htdocs/cacti/include/config.php 输入数据库名,数据库用户名和密码,指定url 2.测试: http://192.168.211.128/cacti 选择new install全新安装 进入环境检查页 检查通过,单击 finsh ,然后输入账户登录,首次登录用户名 admin 密码 admin ,首次需要修改密码,我们修改为 5991460 、 如果出现时区错误,解决方法 1:首先改/etc/php.ini [Date] ; Defines the default timezone used by the date functions ;http://php.net/date.timezone date.timezone ='Asia/Shanghai' 2 :在程序代码中写入 第一行写入:date_default_timezone_set ('Asia/Shanghai'); 登陆之后,我们首先添加主机,然后给该主机分配服务;接着我们添加图集,给图集添加元素,我们将我们刚设置的主机添加入图集,于是就可以通过graphs进行访问图像了。 服务添加过后,图像不会马上显示,需要一定时间,我们可以建立一个计划任务来完成该监控。也可以强制执行php /usr/local/apache2/htdocs/cacti/poller.php &>/dev/null 稍等会看到图集 8. 开启 apache-status 功能 Apache-status是apache的扩展功能,在/usr/local/apache2/conf/extra里面,我们通过命令grep –I“server-status”*查找到该扩展在httpd-info.conf配置文件中,我们然后提取此段代码,然后粘贴到/usr/local/apache2/conf/httpd.conf末尾,然后重启apache服务,使配置生效,然后加载给模块使apache-status模块生效。 /usr/loacl/apache/bin/apachectl -h 该命令查看到帮助,然后知道-t –D DUMP_MOUDULES可以查看所有的静态模块,可以看到有status_module模块,不需要再加载了 http://192.168.211.128/server-status //查看server-status模块 显示访问次数和流量和cpu负载和访问的网站 Apache进程有99个空闲的,我们可以通过 Pstree –p|grep httpd 查看 http 进程 3. Cact 监控 apache 状态 首先下载apache图形模块 Wgethttp://forums.cacti.net/about25227.html&highlight=apachestatus 解压后它包括两个文件ss_aoacge_stats.php和cacti_host_template_webserver_-_apache.xml文件 然后,我们将ss_aoacge_stats.php脚本文件放在cacti/scripts下面,我们将cacti_host_template_webserver_-_apache.xml文件通过web界面导入到cacti。 导入的办法是:console->import templates->浏览->upload 这是我们选择“device”进入主机,这时选择图集便可以看到apahce模块了。 我们创建过图集后,单击“create graphs for this host“->打钩进行启用服务。 这时定位到graphs面板查看图像 7.3cacti插件的安装cactii的功能是通过插件进行完善的,对于0.8.8以上版本不需要安装plungin了。然后直接部署插件就行了。 cacti-0.8.7i-PIA-3.1.tar.gzhttp://down.51cto.com/data/309895 settings-0.5.tar.gz http://docs.cacti.net/_media/plugin:settings-v0.7-1.tgz thold-v0.4.9-3.tgz : http://docs.cacti.net/_media/plugin:thold-v0.4.9-3.tgz monitor-v1.2-1.tgz : http://docs.cacti.net/_media/plugin:monitor-v1.2-1.tgz 其它插件,可以从这里找 http://docs.cacti.net/plugins 下载 还是介绍一下 plugins 的安装: Tar zxvf cacti-0.8.7i-PIA-3.1.tar.gz Cp cacti-plugin-0.8.7h-PA-v3.0.diff /usr/local/apache2/htdocs/cacti//打补丁 Mysql cacti <pa.sql// 导入数据库 Vi /usr/local/apache2/htdocs/cacti/includes/global.php 对于monitor,settings和thold插件的安装,解压后拷贝到/usr/local/apache2/htdocs/cacti/plugins然后执行setfacl –m u:apache:rwx –R htdocs/和setfacl –m d:u:apache:rwx –R htdocs/分配权限即可。 Vi /usr/local/apache2/htdocs/cacti/include/config.php// 定义插件 这时打开图形界面,通过plugin management可以看到定义的插件,然后单击左边的箭头,启动即可,启动后颜色为红色。 这是定位到setting按钮可以看到多了几个misc,mail/dns和template按钮,我们可以设置邮件进行测试,我们使用postfix邮件,定义接收邮箱和端口以及发送邮箱。 我们配置完毕后单击右上角的“send test mail”测试 使用 outlook 进行查看邮件,可以看到收到测试邮件 测试: Console->threahold templates-> 定义新的模版 我们定义一个空间报警的模版,选择“ hara drive space ”图集,然后空间量选择 60 ,时间每五分钟,比例选择 percenter ,占 total 的百分比,输入接收邮箱。 模版可以导出xml文件,然后备用。通过device选择主机->create graph->auto-create thresholds进行调用模版即可。 7.4压力测试 7.4.1apache压力测试 Apache2.2之后的版本有ab压力测试工具可以直接使用 /usr/local/apache2/bin/ab –c 10 –n 1000http://ip/index.php 表示10个用户发送1000次请求 我们可以在htdocs中建立内容相同的index.html和index.php页面 测试:/usr/local/apache2/bin/ab –c 10 –n 1000 http://192.168.211.128/index.html /usr/local/apache2/bin/ab –c 10 –n 1000 http://192.168.211.128/index.php 可以看到html的速度要快于php页面,静态页面还是快一些的。 7.4.2mysqlslap压力测试 Mysql5.1 以上版本的数据拥有这个测试工具。 50,100个用户,请求3000次,重复5次操作,分别对myisam和innodb引擎进行测试 本文转自zsaisai 51CTO博客,原文链接:http://blog.51cto.com/3402313/970873

优秀的个人博客,低调大师

将文件复制到ftp服务器时发生错误

这个问题是由于FTP底层文件传输协议文件名代码转化不一致导致的。 解决方法:将文件重新命名为纯英文或者数字或者英文数字组合字符,中文命名必须使用偶数字符,奇数中文字符+中文字符会导致传输失败。(自己可以尝试不同的字符组合以获得经验) 这种问题出现在安卓手机上,很多人希望通过WIFI使用FTP协议无线向手机中传入数据,由于windows与linux之间的FTP文件名限制导致上述错误的产生。该问题属系统兼容性故障,较难解决(几乎无法根本解决,只能通过用户修改文件名)。很难评定是windows系统的问题还是android系统的问题,但可以肯定第三方提供wifi数据传输的软件没有问题。 本文转自 技术花妞妞 51CTO博客,原文链接:http://blog.51cto.com/xiaogongju/1948518

优秀的个人博客,低调大师

查找谁在破解你linux服务器的密码?

首先知道,系统的用户登陆日志文件是/var/log/secure,所以分析统计这文件就可以 #tail -n50 secure-20161219 (可以看到大量Failed password的记录) Dec 19 03:41:35 localhost sshd[9014]: Failed password for root from 59.63.166.84 port 26368 ssh2 Dec 19 03:41:36 localhost sshd[9014]: Failed password for root from 59.63.166.84 port 26368 ssh2 Dec 19 03:41:37 localhost sshd[9014]: Failed password for root from 59.63.166.84 port 26368 ssh2 Dec 19 03:41:37 localhost sshd[9014]: Failed password for root from 59.63.166.84 port 26368 ssh2 Dec 19 03:41:38 localhost sshd[9014]: Failed password for root from 59.63.166.84 port 26368 ssh2 Dec 19 03:41:38 localhost sshd[9014]: error: maximum authentication attempts exceeded for root from 59.63.166.84 port 26368 ssh2 [preauth] Dec 19 03:41:38 localhost sshd[9014]: Disconnecting: Too many authentication failures [preauth] Dec 19 03:41:39 localhost sshd[9016]: Failed password for root from 59.63.166.84 port 32555 ssh2 我们要过滤出Failed行并显示对他的ip地址做统计排序,找到攻击最大的几个 #awk '/Failed password/{print $(NF-3)}' secure-20161219|sort|uniq -c|sort -nrk1|head -20 68652 218.65.30.25 34326 218.65.30.53 21201 218.87.109.154 18065 112.85.42.103 17164 112.85.42.99 17163 218.87.109.151 17163 218.87.109.150 17163 218.65.30.61 17163 218.65.30.126 17163 218.65.30.124 17163 218.65.30.123 17163 218.65.30.122 17163 182.100.67.120 17163 182.100.67.119 17163 112.85.42.124 17163 112.85.42.107 3289 222.186.50.206 3265 219.133.29.16 3206 111.73.46.156 2479 117.21.226.189 (解释下# awk '/Failed password/{print $(NF-3)}' secure-20161219|sort|uniq -c|sort -nrk1|head -20) awk根据Failed password匹配出了破解记录,然后取倒数第四列的ip,取到的结果先进行排序(目的是为了下一个uniq函数),uniq -c去重并计算数目(只支持比较连续的行所以前面用sort),对去重后的数据按照第一列(-k1)进行数字(n)倒序(r),最后只取前20行 第二种方法(awk数组方式): #awk '/Failed password/{d[$(NF-3)]++}END{for(i in d) print i,d[i]}' secure-20161219|sort -nrk2|head -20 218.65.30.25 68652 218.65.30.53 34326 218.87.109.154 21201 112.85.42.103 18065 112.85.42.99 17164 218.87.109.151 17163 218.87.109.150 17163 218.65.30.61 17163 218.65.30.126 17163 218.65.30.124 17163 218.65.30.123 17163 218.65.30.122 17163 182.100.67.120 17163 182.100.67.119 17163 112.85.42.124 17163 112.85.42.107 17163 222.186.50.206 3289 219.133.29.16 3265 111.73.46.156 3206 117.21.226.189 2479

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册