yum install vsftpd -y
systemctl enable vsftpd
yum install mariadb* -y
yum install pam-devel pam -y
yum install gcc gcc-c++ -y
或直接安装开发环境
yum groupinstall "Development Tools" "Server Platform Development" -y
yum install pam_mysql -y
若库里没有pam_mysql,则需要手动下载编译:
(1) 下载pam_mysql-0.7RC1.tar.gz
https://sourceforge.net/projects/pam-mysql/files/latest/download
(2) 编译安装
复制pam_mysql-0.7RC1.tar.gz到root目录
cd ~
tar xvf pam_mysql-0.7RC1.tar.gz
cd pam_mysql-0.7RC1
./configure --with-pam=/usr --with-mysql=/usr --with-pam-mods-dir=/usr/lib64/security
make && make install
cd /usr/lib64/security
ls | grep pam_mysql.so #如果存在pam_mysql.so,则说明pam_mysql安装成功
systemctl start mariadb
systemctl enable mariadb
mysql -u root -p -h localhost #mariadb root密码默认为空
GRANT ALL ON vsftpd.* TO mysqlftp@'127.0.0.1' IDENTIFIED BY 'Mima123';
FLUSH PRIVILEGES;
exit;
mysql -umysqlftp -pMima123 -h127.0.0.1
CREATE DATABASE vsftpd;
USE vsftpd;
CREATE table users (
id INT AUTO_INCREMENT NOT NULL,
username VARCHAR(30) BINARY UNIQUE NOT NULL,
password VARCHAR(128) BINARY NOT NULL,
PRIMARY KEY(id)
);
INSERT INTO users(username,password) VALUES ('ftpadmin',PASSWORD('Mima123')),('ftpuser1',PASSWORD('Mima123')),('ftpuser2',PASSWORD('Mima123'));
exit
mkdir /FTPRepository
useradd -M -d /FTPRepository -s /sbin/nologin vsftp
vim /etc/pam.d/vsftpd.mysql
#键入以下内容:
auth required /usr/lib64/security/pam_mysql.so user=mysqlftp passwd=Mima123 host=127.0.0.1 db=vsftpd table=users usercolumn=username passwdcolumn=password crypt=2
account required /usr/lib64/security/pam_mysql.so user=mysqlftp passwd=Mima123 host=127.0.0.1 db=vsftpd table=users usercolumn=username passwdcolumn=password crypt=2
anonymous_enable=NO
#virtual_use_local_privs=YES
guest_enable=YES
pam_service_name=vsftpd.mysql
guest_username=vftp
user_config_dir=/etc/vsftpd/virtual_user_conf
systemctl restart vsftpd
mkdir -p /etc/vsftpd/virtual_user_conf && cd $_
vim ftpadmin
#键入以下内容:
anon_upload_enable=YES #允许上传
anon_mkdir_write_enable=YES #允许创建目录
anon_other_write_enable=YES #允许其他写操作
allow_writeable_chroot=YES #允许切换目录
anon_umask=022 #ftpadmin用户创建的目录权限为755
vim ftpuser1
#键入以下内容
download_enable=YES #允许下载
vim ftpuser2
#键入以下内容
anon_upload_enable=YES #允许上传
anon_umask=022 #ftpuser1用户上传的目录权限为755
注:
虚拟用户ftpadmin、ftpuser1、ftpuser2相当于本地用户vftp的副本,使用虚拟用户创建文件和目录时,该文件和目录的所属用户和所属组为vftp:vftp。
当/FTPRepository的所属用户和所属组为root:root,且权限为755时,即使赋予虚拟用户创建文件和目录的权限,虚拟用户也不能在/FTPRepository 下创建目录和文件,这是因为vftp用户相对于root,属于其他用户,而其他用户的权限仅为r_x。
此时,如果希望虚拟用户拥有创建文件和目录的权限,可以将虚拟用户设置为root的副本。具体操作如下:
mkdir /FTPRepository
chmod 755 /FTPRepository
anonymous_enable=NO
#virtual_use_local_privs=YES
guest_enable=YES
pam_service_name=vsftpd.mysql
guest_username=root
user_config_dir=/etc/vsftpd/virtual_user_conf
systemctl restart vsftpd
ftpadmin:
mkdir -p /etc/vsftpd/virtual_user_conf && cd $_
vim ftpadmin
#键入以下内容:
#该虚拟用户登录ftp服务器时,根目录为/FTPRepository
local_root=/FTPRepository
#允许上传
anon_upload_enable=YES
#允许创建目录
anon_mkdir_write_enable=YES
#允许其他写操作:改、删
anon_other_write_enable=YES
#允许下载
download_enable=YES
#允许切换目录。
#使用该虚拟用户登录ftp服务器时,理论上默认登录的目录是与虚拟用户同名的目录,这里在此配置文件中将默认目录改为了/FTPRepository ,如果不添加此配置,则使用该虚拟用户登录ftp时会报错:500 OOPS:vsftpd:refusing to run with writeable root inside chroot()
allow_writeable_chroot=YES
#ftpadmin创建的目录权限为755,因为ftpadmin是root用户的副本,此处如果不指定权限,则默认同root权限。可以使用umask命令来查看当前登录用户的权限,如果不是0022,可以在/etc/profile中增加一行umask 0022,然后source /etc/profile,使立即生效。
anon_umask=022
ftpuser1:
vim ftpuser1
#键入以下内容:
#该虚拟用户登录ftp服务器时,根目录为/FTPRepository
local_root=/FTPRepository
#允许上传
anon_upload_enable=NO
#不允许创建目录
anon_mkdir_write_enable=NO
#允许下载
download_enable=YES
#允许切换目录。
allow_writeable_chroot=YES
anon_umask=022
ftpuser2:
vim ftpuser2
#键入以下内容:
#该虚拟用户登录ftp服务器时,根目录为/FTPRepository
local_root=/FTPRepository
#允许上传
anon_upload_enable=YES
#不允许创建目录
anon_mkdir_write_enable=NO
#不允许下载
download_enable=NO
#允许切换目录。
allow_writeable_chroot=YES
anon_umask=022
如果在阿里云上搭建FTP服务器后,在windows资源管理器中使用ftp://ftp_ip访问搭建的服务器时,出现下面两种错误:
打开FTP服务器上的文件夹时发生错误。请检查是否有权限访问该文件夹。
详细信息:
200 Switching to ASCII mode.
227 Entering Passive Mode(172,22,47,109,39,18)
打开FTP服务器上的文件夹时发生错误。请检查是否有权限访问该文件夹。
详细信息:
操作超时
需要在配置文件中添加下面几句,并在阿里云安全组中开放10000~10020端口:
pasv_address=ftp服务器公网ip
pasv_enable=YES
pasv_min_port=10000
pasv_max_port=10020
详见:https://developer.aliyun.com/article/601945
# 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).
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. The vsftpd.conf(5) man page explains
# the behaviour when these options are disabled.
# 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=YES
#
# 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=NO
pasv_address=阿里云服务器公网ip
pasv_enable=YES
pasv_min_port=10000
pasv_max_port=10020
userlist_enable=YES
tcp_wrappers=YES
guest_enable=YES
pam_service_name=vsftpd.mysql
guest_username=root
user_config_dir=/etc/vsftpd/virtual_user_conf
我想安装一个带有一些身份验证的私有(private)Rubygem服务器。我希望能够使用公共(public)Ubuntu服务器托管内部gem。我读到了http://docs.rubygems.org/read/chapter/18.但是那个没有身份验证-如我所见。然后我读到了https://github.com/cwninja/geminabox.但是当我使用基本身份验证(他们在他们的Wiki中有)时,它会提示从我的服务器获取源。所以。如何制作带有身份验证的私有(private)Rubygem服务器?这是不可能的吗?谢谢。编辑:Geminabox问题。我尝试“捆绑”以安装新的gem..
我正在尝试在我的centos服务器上安装therubyracer,但遇到了麻烦。$geminstalltherubyracerBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtherubyracer:ERROR:Failedtobuildgemnativeextension./usr/local/rvm/rubies/ruby-1.9.3-p125/bin/rubyextconf.rbcheckingformain()in-lpthread...yescheckingforv8.h...no***e
最近,当我启动我的Rails服务器时,我收到了一长串警告。虽然它不影响我的应用程序,但我想知道如何解决这些警告。我的估计是imagemagick以某种方式被调用了两次?当我在警告前后检查我的git日志时。我想知道如何解决这个问题。-bcrypt-ruby(3.1.2)-better_errors(1.0.1)+bcrypt(3.1.7)+bcrypt-ruby(3.1.5)-bcrypt(>=3.1.3)+better_errors(1.1.0)bcrypt和imagemagick有关系吗?/Users/rbchris/.rbenv/versions/2.0.0-p247/lib/ru
在Rails4.0.2中,我使用s3_direct_upload和aws-sdkgems直接为s3存储桶上传文件。在开发环境中它工作正常,但在生产环境中它会抛出如下错误,ActionView::Template::Error(noimplicitconversionofnilintoString)在View中,create_cv_url,:id=>"s3_uploader",:key=>"cv_uploads/{unique_id}/${filename}",:key_starts_with=>"cv_uploads/",:callback_param=>"cv[direct_uplo
您如何在Rails中的实时服务器上进行有效调试,无论是在测试版/生产服务器上?我试过直接在服务器上修改文件,然后重启应用,但是修改好像没有生效,或者需要很长时间(缓存?)我也试过在本地做“脚本/服务器生产”,但是那很慢另一种选择是编码和部署,但效率很低。有人对他们如何有效地做到这一点有任何见解吗? 最佳答案 我会回答你的问题,即使我不同意这种热修补服务器代码的方式:)首先,你真的确定你已经重启了服务器吗?您可以通过跟踪日志文件来检查它。您更改的代码显示的View可能会被缓存。缓存页面位于tmp/cache文件夹下。您可以尝试手动删除
需求:要创建虚拟机,就需要给他提供一个虚拟的磁盘,我们就在/opt目录下创建一个10G大小的raw格式的虚拟磁盘CentOS-7-x86_64.raw命令格式:qemu-imgcreate-f磁盘格式磁盘名称磁盘大小qemu-imgcreate-f磁盘格式-o?1.创建磁盘qemu-imgcreate-fraw/opt/CentOS-7-x86_64.raw10G执行效果#ls/opt/CentOS-7-x86_64.raw2.安装虚拟机使用virt-install命令,基于我们提供的系统镜像和虚拟磁盘来创建一个虚拟机,另外在创建虚拟机之前,提前打开vnc客户端,在创建虚拟机的时候,通过vnc
作为新的阿里云用户,您可以50免费试用多种优惠,价值高达1,700美元(或8,500美元)。这将让您了解和体验阿里云平台上提供的一系列产品和服务。如果您以个人身份注册免费试用,您将获得价值1,700美元的优惠。但是,如果您是注册公司,您可以选择企业免费试用,提交基本信息通过企业实名注册验证,即可开始价值$8,500的免费试用!本教程介绍了如何设置您的帐户并使用您的免费试用版。关于免费试用在我们开始此试用之前,您还必须遵守以下条款和条件才能访问您的免费试用:只有在一年内创建的账户才有资格获得阿里云免费试用。通过此免费试用优惠,用户可以免费试用免费试用活动页面上列出的每种产品一次。如果您有多个帐
基础版云数据库RDS的产品系列包括基础版、高可用版、集群版、三节点企业版,本文介绍基础版实例的相关信息。RDS基础版实例也称为单机版实例,只有单个数据库节点,计算与存储分离,性价比超高。说明RDS基础版实例只有一个数据库节点,没有备节点作为热备份,因此当该节点意外宕机或者执行重启实例、变更配置、版本升级等任务时,会出现较长时间的不可用。如果业务对数据库的可用性要求较高,不建议使用基础版实例,可选择其他系列(如高可用版),部分基础版实例也支持升级为高可用版。基础版与高可用版的对比拓扑图如下所示。优势 性能由于不提供备节点,主节点不会因为实时的数据库复制而产生额外的性能开销,因此基础版的性能相对于
大家好,我正在尝试设置一个开发环境,并且我一直在关注以下教程:Linktotutorial我做得不是很好,除了最基本的版本控制内容外,我对终端命令没有任何实际经验。我点击了第一个链接并尝试运行source~/.bash_profile我得到了错误;mkdir:/usr/local/rbenv/shims:权限被拒绝mkdir:/usr/local/rbenv/versions:权限被拒绝现在每次我加载终端时都会出现错误。bash_profile的内容;exportPATH=/usr/local/rbenv/bin:$PATHexportRBENV_ROOT=/usr/local/rbe
require"socket"server="irc.rizon.net"port="6667"nick="RubyIRCBot"channel="#0x40"s=TCPSocket.open(server,port)s.print("USERTesting",0)s.print("NICK#{nick}",0)s.print("JOIN#{channel}",0)这个IRC机器人没有连接到IRC服务器,我做错了什么? 最佳答案 失败并显示此消息::irc.shakeababy.net461*USER:Notenoughparame