freebsd

FreeBSD下vsftp安装配置详解

大兔子大兔子 提交于 2019-12-10 17:57:39
FreeBSD功能强大,ftp服务器只是它其中的很基础的一种服务,但是作为日常的服务器运作ftp服务却是必不可少,本篇是本人自己在学习FreeBSD的服务器设置过程中的一些积累,因为自己也曾是由菜鸟入门,走了不少弯路,现在把自己的一些经验总结出来,供大家参考,希望对新人能有所帮助,不足之处还请大家多多指点. 1 、安装 通过 ports 安装,这个方式比较简单。 # cd /usr/ports/ftp/vsftp # make install 2 、配置 (1) 编辑 /usr/local/etc/vsftpd.conf # ee /usr/local/etc/vsftpd.conf Anonymous_enable=NO ( 禁止匿名登陆 ) Local_enable=YES ( 允许本地用户登陆 ) Local_umask=022 (FTP 上本地的文件权限 755 ,默认是 077) Connect_form_port_20=yes ( 启用 FTP 数据端口的数据连接 ) Xferlog_enable=yes ( 激活上传和下传的日志 ) Xferlog_std_format=yes ( 使用标准的日志格式 ) Idle_session_timeout=120( 秒 ) ( 用户会话空闲后 2 分钟 ) Data_connection_timeout=300( 秒 ) (

FreeBSD 安装vsftpd 并配置pam_mysql 实现虚拟用户登录

坚强是说给别人听的谎言 提交于 2019-12-10 17:57:25
一、安装所需软件 1、MySQL 安装过程请见另一篇文章 2、vsFTPd cd /usr/ports/ftp/vsftpd make install clean 3、pam_mysql cd /usr/ports/security/pam-mysql make install clean 二、配置 1、添加虚拟用户映射的系统用户vsftpd,密码为空,禁止终端登陆,并设置相应的ftp目录: # pw useradd vsftpd -s /sbin/nologin # chmod go+rx /home/vsftpd (使其目录有写的权限) 2、建立数据库vsftp和表users,logs #mysql> create database vsftpd; #mysql> use vsftpd; #mysql> create table users ( id int AUTO_INCREMENT NOT NULL,name char(63) binary NOT NULL, passwd char(63) binary NOT NULL,primary key(id)); #mysql> Create table logs ( message Varchar(255),user Varchar(63),pid Int,host Varchar(63), rhost Varchar(63

FREEBSD上vsftp+MYSQL实现虚拟用户验证

混江龙づ霸主 提交于 2019-12-10 17:57:11
1、VSFTP配置 vsftpd.conf的配置。PORT安装 listen=yes guest_enable=yes guest_username=vsftpdguest 其它按默认配置。 2、PAM验证配置 /etc/pam.d/ftp,使用默认ftp的文件,但已经将/etc/pam.d/ftp清空,填入以下, auth required pam_mysql.so user=vsftpdguest passwd=vsftpdguest host=localhost db=vsftpd table=us ers usercolumn=name passwdcolumn=passwd crypt=2 account required pam_mysql.so user=vsftpdguest passwd=vsftpdguest host=localhost db=vsftpd table =users usercolumn=name passwdcolumn=passwd crypt=2 用wc -l /etc/pam.d/ftp返回值为2行。 3、MYSQL内的数据库配置 # mysql mysql> create database vsftpd; mysql> use vsftpd; mysql> create table users(name varchar(20)

FreeBSD下配置vsftpd虚拟用户-mysql安装配置

夙愿已清 提交于 2019-12-10 17:31:10
VSFTPD是一个安全高效的FTP服务软件,得到了广泛的应用。 本地用户经过设置后可以进行ftp访问。而匿名用户的访问经过了转换,在系统中。匿名用户的用户名为ftp,系统将其属性设置为根目录/var/ftp/,控制台登陆,也就是,该用户只能进行ftp访问。 FreeBSD下配置vsftpd虚拟用户-mysql安装配置, VSFTPD有两种开机自启动模式:inet模式和standalone模式,推荐使用standalone模式 。两种模式的启动方法依次为: 3.虚拟用户的设置 所谓虚拟用户,就是在本地用户中不存在,而又可以远程登陆的ftp用户。一般多采用pam认证方式。本节只考虑使用pam_pwdfile.so库文件进行认证。更多的可能采用的是mysql数据库进行认证 。 来源: oschina 链接: https://my.oschina.net/u/187928/blog/33923

when is the arg for F_GETFL fcntl command required?

房东的猫 提交于 2019-12-10 17:13:46
问题 int fcntl(int fd, int command, ... /* arg */ ); Is it portable: flags = fcntl(fd, F_GETFL); (note: no arg )? Both Linux and FreeBSD man pages say that arg is ignored: F_GETFL (void) Get the file access mode and the file status flags; arg is ignored. void in Linux documentation means that arg is not required. Here's a usage example from POSIX for a related F_GETFD flag: #include <unistd.h> #include <fcntl.h> ... int flags; flags = fcntl(fd, F_GETFD); if (flags == -1) /* Handle error */; flags

Thin/eventmachine non-root installation problem

杀马特。学长 韩版系。学妹 提交于 2019-12-10 12:24:21
问题 Trying to run ruby on rails framework under nginx+thin, currently working under WEBrick. I don't have root access, cause it is hosted at web hosting service. Till this moment all problems with gems solved w/o root access. thin requires eventmachine, so: $ gem install eventmachine Building native extensions. This could take a while... ERROR: Error installing eventmachine: ERROR: Failed to build gem native extension. /usr/local/bin/ruby18 extconf.rb checking for rb_trap_immediate in ruby.h

How to get list of open posix shared memory segments in FreeBSD

我与影子孤独终老i 提交于 2019-12-10 04:13:19
问题 In linux i can get list of opened posix shared memory segments by getting /dev/shm directory listing. How do i programmatically get list of all opened posix shared memory segments in FreeBSD? Assuming segments opened with shm_open and i don't know even a part of a name that was used as a first argument of shm_open. 回答1: You can't. See the comment in /sys/kern/uipc_shm.c: * TODO: * * (2) Need to export data to a userland tool via a sysctl. Should ipcs(1) * and ipcrm(1) be expanded or should

grep -f on OS X produces segfault

徘徊边缘 提交于 2019-12-09 16:51:36
问题 If you've got a Mac, try this: echo 'abcd*' > grepfile echo 'abc$' >> grepfile echo '^abc' >> grepfile echo "fojeiwuroiuwet\nljfajsljkfabcdddjlfkajlkj\nabcaaa\nzzzabc\n" | grep -f grepfile Here's the version: $ grep --v grep (BSD grep) 2.5.1-FreeBSD This is a machine (a rMBP of the 2012 flavor) that's kept up with Apple's software updates, so I am on 10.8.4. I verified that GNU grep compiled from source does not suffer from this problem. Indeed it is version 2.14, which is a whole lot of

one-liner: print all lines except the last 3?

拟墨画扇 提交于 2019-12-09 03:34:14
问题 I would like to simulate GNU's head -n -3 , which prints all lines except the last 3, because head on FreeBSD doesn't have this feature. So I am thinking of something like seq 1 10 | perl -ne ... Here I have used 10 lines, but it can be any number larger than 3. Can it be done in Perl or some other way on FreeBSD in BASH? A super primitive solution would be seq 1 10 | sed '$d' | sed '$d' | sed '$d' 回答1: This works with a pipe as well as an input file: seq 1 10 | perl -e'@x=<>;print@x[0..$#x-3

How to run aout on linux?

让人想犯罪 __ 提交于 2019-12-09 03:18:59
问题 The question is how to execute aout-format binary (I mean old format which for example used on FreeBSD before it has migrated to ELF) on Linux system. Is there a possibility to do so without extra coding (is there some existing solution)? Probably it should be in form of kernel module or patch for the Linux kernel. Another solution could be user-space launcher (may be even run-time linker). I have searched for something similar but was unable to found something. I have not yet checked