1.cd ~/code_bak
2.git clone --mirror https://github.com/coturn/coturn.git
3.git --git-dir=~/code_bak remote update,同步更新镜像
4.git push --mirror https://github.com/yyyy/xxxx.git
分类目录归档:Linux开发
摘:CentOS7安装配置VSFTPD(虚拟用户方式)
一、安装
1. 查看是否安装vsftpd
rpm -qa | grep vsftpd
2. 安装
yum -y install vsftpd
3. 设置开机启用
ckconfig vsftpd on
二、配置vsftpd
打开vsftpd配置文件
# vi /etc/vsftpd/vftpd.conf
#设定不允许匿名访问
anonymous_enable=NO
#设定本地用户可以访问。注:如使用虚拟宿主用户,在该项目设定为NO的情况下所有虚拟用户将无法访问
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
#记录上传下载文件的日志
xferlog_enable=YES
connect_from_port_20=YES
chown_uploads=YES
chown_username=ftp
#日志记录文件位置
xferlog_file=/var/log/vsftpd.log
#格式化日志
xferlog_std_format=YES
#设定支持ASCII模式的上传和下载功能
ascii_upload_enable=YES
ascii_download_enable=YES
//使用户不能离开主目录
chroot_list_enable=YES
#chroot_list_file=/etc/vsftpd/chroot_list
ls_recurse_enable=YES
#监听IPv4 sockets
listen=YES
#注释IPv6 sockets监听
#listen_ipv6=YES
#PAM认证文件名。PAM将根据/etc/pam.d/vsftpd进行认证 //已下三个请在配置文件中手动添加
pam_service_name=vsftpd
userlist_enable=YES
userlist_deny=YES
#/etc/vsftpd/user_list中的用户禁止登录ftp
#如果只配置userlist_enable=YES,有可能出现错误 “530 Permission denied”,因此加上如下配置
userlist_file=/etc/vsftpd/user_list
tcp_wrappers=YES
#设定启用虚拟用户功能
guest_enable=YES
//指定虚拟用户的宿主用户,CentOS中已经有内置的ftp用户了
guest_username=ftp
#设定虚拟用户个人vsftp的CentOS FTP服务文件存放路径。存放虚拟用户个性的CentOS FTP服务文件(配置文件名=虚拟用户名)
user_config_dir=/etc/vsftpd/vuser_conf
pasv_min_port=61001
pasv_max_port=62000
#文件上传下载权限设置
allow_writeable_chroot=YES
anon_umask=022
file_open_mode=777
#虚拟用户和本地用户有相同的权限
virtual_use_local_privs=YES
三、创建chroot list,将vftpd.conf配置文件中的guest_username加入其中:
# touch /etc/vsftpd/chroot_list
# echo ftp >> /etc/vsftpd/chroot_list
四、创建用户密码文件
# touch /etc/vsftpd/vuser_passwd.txt
##注意奇行是用户名,偶行是密码
test
111222
五、生成虚拟用户认证的db文件
如果没有db4需要先进行安装。安装Berkeley DB工具:
# yum install db4 db4-utils
生成虚拟用户认证的db文件:
# db_load -T -t hash -f /etc/vsftpd/vuser_passwd.txt /etc/vsftpd/vuser_passwd.db
六、编辑认证文件:
# vi /etc/pam.d/vsftpd
全部注释掉原来语句再增加以下两句:
##查看系统版本号
# getconf LONG_BIT
#系统为32位的
auth required pam_userdb.so db=/etc/vsftpd/vuser_passwd
account required pam_userdb.so db=/etc/vsftpd/vuser_passwd
#系统为64位的
auth required /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_passwd
account required /lib64/security/pam_userdb.so db=/etc/vsftpd/vuser_passwd
七、创建虚拟用户配置文件
# mkdir /etc/vsftpd/vuser_conf/
#文件名等于vuser_passwd.txt里面的账户名,否则下面设置无效
# vi /etc/vsftpd/vuser_conf/test
##内容如下:
#虚拟用户根目录,根据实际情况修改(如果没有需要创建)。该目录必须要有读写权限 chmod -R 777 目录。
local_root=/var/ftp/upload
#可写
write_enable=YES
#掩码
anon_umask=022
anon_world_readable_only=NO
anon_upload_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
八、设置防火墙
打开防火墙设置:
# vi /etc/sysconfig/iptables
注释其他,新加如下
# -A INPUT –m state –state NEW –m tcp –p tcp –dport 22 –j ACCEPT
# -A INPUT -m state –state NEW -m tcp -p tcp –dport 21 -j ACCEPT
# -A INPUT -m state –state NEW -m tcp -p tcp –dport 10060:10090 -j ACCEPT
然后保存,并关闭该文件,在终端内运行下面的命令,刷新防火墙配置:
# systemctl restart firewalld.service
如果上传下载中出现错误,看下日志vsftpd.conf(xferlog_file):
tail /var/log/vsftpd.log
如果安装过程中出现错误,可看日志:
tail /var/log/secure
docker之portainer搭建
1.安装docker
sudo yum install docker
2.需要使用到htpasswd命令创建密码,故需安装相关组件。
yum install httpd-tools -y
htpasswd -nb -B admin
https://portainer.readthedocs.io/en/stable/configuration.html
4.编写简单的运行脚本
#!/bin/sh
mode=$1
dockerd_current=`ps -ef | grep "dockerd-current"| grep -v grep`
portainer=`ps -ef | grep "portainer --admin-password"| grep -v grep`
case "$mode" in
'start')
echo "it's ready to start op...."
if test -n "$dockerd_current"; then
echo "---the docker.service had already started.."
else
`sudo systemctl start docker.service`
fi
if test -n "$portainer"; then
echo "---the portainer had already started.."
else
`sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer --admin-password '$2y$05$iOIorOhtjjymgIQT2x2n4.HWAUHCCV0QpvOdKkhJR2t9.s61O3uAe'`
fi
echo 'success to start.'
echo '---1--you can test portainer by way bellow----'
echo 'http://localhost:9000'
echo 'user:admin password:123456'
;;
'stop')
echo "it's ready to check process..."
`sudo systemctl stop docker.service`
echo 'success to kill.'
;;
*)
basename=`basename "$0"`
echo "Usage: $basename {start|stop} [ portainer server options ]"
exit 1
;;
esac
exit 1
PHP函数在线测试
在线执行不同版本的同一份php代码,可以方便进行不同版本的函数测试。
http://sandbox.onlinephpfunctions.com/
intel推出dpdk网络开发包
intel推出的dpdk网络开发包
http://dpdk.org/
DPDK is a set of libraries and drivers for fast packet processing.
It is designed to run on any processors. The first supported CPU was Intel x86 and it is now extended to IBM POWER and ARM.
It runs mostly in Linux userland. A FreeBSD port is available for a subset of DPDK features.
DPDK is an Open Source BSD licensed project. The most recent patches and enhancements, provided by the community, are available in master branch.
Main libraries
multicore framework
huge page memory
ring buffers
poll-mode drivers for networking , crypto and eventdev
奇虎的C++服务器开源
奇虎的C++开源
https://github.com/Qihoo360
https://github.com/Qihoo360/evpp
WIKI相关的开源工具
gitlab、dokuwiki、redmine开源免费工具
vmware在Centos7共享文件夹
1.重装vmware-tools工具,把VMwareTools-10.0.1-3160059.tar.gz包拷到任意目录并解压。
执行./vmware-install.pl安装,后续过程不断按回车,使用默认值,即可。
2.在root权限下,执行
mount -t vmhgfs .host:/ /mnt/hgfs
如果报错 ERROR: can not mount filesystem: No such device,则改用如下命令:
vmhgfs-fuse .host:/ /mnt/hgfs,这个是当前测试通过的
3.配置启动项【vim /etc/rc.local】,使用随系统启动,默认开启。
vmhgfs-fuse .host:/ /mnt/hgfs
cd /mnt/hgfs目录下,检查是否OK.需要root权限
ELK的启动和停止脚本
#!/bin/sh
path_base=`pwd`
path_elastic="$path_base/elasticsearch-5.5.1/bin/elasticsearch"
path_kibana="$path_base/kibana-5.5.1/bin/kibana"
path_logstash="$path_base/logstash-5.5.1/bin/logstash"
mode=$1
kibana_process=`ps -ef | grep "kibana"| grep -v grep`
elastic_process=`ps -ef | grep "elasticsearch"| grep -v grep|grep -v controller`
case "$mode" in
'start')
echo "it's ready to start op...."
if test -n "$elastic_process"; then
echo "---the elasticsearch had already started.."
else
`$path_elastic -d`
fi
if test -n "$kibana_process"; then
echo "---the kibana had already started.."
else
`nohup $path_kibana > /dev/null 2>&1 &`
fi
echo 'success to start.'
echo '---1--you can test logstash by way bellow----'
echo 'cd logstash-5.5.1 && bin/logstash -f ./config/test.conf && cd ..'
echo 'or cd logstash-5.5.1 && bin/logstash -f ./config/h5.api.vip.com.conf && cd ..'
;;
'stop')
echo "it's ready to check process..."
if test -n "$kibana_process"; then
echo "had find kibana process.."
`echo $kibana_process | awk '{print ($2)}' | xargs kill -9`
fi
if test -n "$elastic_process"; then
echo "had find elasticsearch process.."
`echo $elastic_process | awk '{print ($2)}' | xargs kill -9`
fi
echo 'success to kill.'
;;
*)
basename=`basename "$0"`
echo "Usage: $basename {start|stop} [ ELK server options ]"
exit 1
;;
esac
exit 1
比ldd更好用的strace命令
strace -o whoami-strace.txt whoami
执行ldd会显相关依赖的最终结果,而strace则显示依赖的检查过程。
strace -o whoami-strace.txt whoami
open("/lib/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/lib/i686/mmx/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i686/mmx", 0xbffff190) = -1 ENOENT (No such file or directory)
open("/lib/i686/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/i686", 0xbffff190) = -1 ENOENT (No such file or directory)
open("/lib/mmx/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib/mmx", 0xbffff190) = -1 ENOENT (No such file or directory)
open("/lib/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/lib", {st_mode=S_IFDIR|0755, st_size=2352, ...}) = 0
open("/usr/lib/i686/mmx/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/i686/mmx", 0xbffff190) = -1 ENOENT (No such file or directory)
open("/usr/lib/i686/libnss_files.so.2", O_RDONLY) = -1 ENOENT (No such file or directory)