`
jerome_wang
  • 浏览: 147740 次
  • 性别: Icon_minigender_1
  • 来自: 云南
社区版块
存档分类
最新评论

liunx FTP 配置 与相关问题

 
阅读更多

                                             
 [root@www ~]#
yum -y install vsftpd
[root@www ~]#
vi /etc/vsftpd/vsftpd.conf
# line 12: no anonymous

anonymous_enable=
NO
# line 80,81: uncomment ( allow ascii mode )

ascii_upload_enable=YES
ascii_download_enable=YES
# line 95, 96: uncomment ( enable chroot )

chroot_local_user=YES
chroot_list_enable=YES
# line 98: uncomment ( specify chroot list )

chroot_list_file=/etc/vsftpd/chroot_list
# line 104: uncomment

ls_recurse_enable=YES
# add at the last line

# specify root directory ( if don't specify, users' home directory become FTP home directory)

local_root=public_html
# use localtime

use_localtime=YES
[root@www ~]#
vi /etc/vsftpd/chroot_list
# add users you allow to move over their home directory

cent
[root@www ~]#
/etc/rc.d/init.d/vsftpd start

Starting vsftpd for vsftpd:
[ OK ]

[root@www ~]#
chkconfig vsftpd on
 
 
1、添加用户,首先用adduser命令添加一个普通用户,命令如下:

#adduser tommy

//添加一个名为tommy的用户

#passwd tommy //修改密码

Changing password for user tommy.

New UNIX password: //在这里输入新密码

Retype new UNIX password: //再次输入新密码

passwd: all authentication tokens updated successfully.

2、赋予root权限

方法一: 修改/etc/sudoers 文件,找到下面一行,把前面的注释(#)去掉

## Allows people in group wheel to run all commands

%wheel ALL=(ALL) ALL

然后修改用户,使其属于root组(wheel),命令如下:

#usermod -g root tommy

修改完毕,现在可以用tommy帐号登录,然后用命令su – ,即可获得root权限进行操作。

方法二: 修改/etc/sudoers 文件,找到下面一行,在root下面添加一行,如下所示:

## Allow root to run any commands anywhere

root ALL=(ALL) ALL

tommy ALL=(ALL) ALL

修改完毕,现在可以用tommy帐号登录,然后用命令su – ,即可获得root权限进行操作。

方法三: 修改/etc/passwd 文件,找到如下行,把用户ID修改为0 ,如下所示:

tommy:x:500:500:tommy:/home/tommy:/bin/bash

修改后如下

tommy:x:0:500:tommy:/home/tommy:/bin/bash

保存,用tommy账户登录后,直接获取的就是root帐号的权限。

友情提醒:虽然方法三看上去简单方便,但一般不推荐使用,推荐使用方法二。

 

vsftpd dead , but subsys locked –解除方法汇总(Red Hat Enterprise Linux 4)

系统: RHEL4

ftp软件:vsftpd 2.**** , 与 xinetd 分离运行.

状态: 执行用service vsftpd status ->vsftpd dead, but subsys locked ,重新安装vsftp,结果依旧.

1. 先删除 /var/lock/subsys/vsftpd -> rm -frv /var/lock/subsys/vsftpd

2. 以下几种可能的解决方法(或者关系)

a. 仔细检查/etc/vsftpd/vsftpd.conf的配置文件的内容格式.确定正确,主要是全角半角字符的编码错误.

b. 确认 listen=YES TCP_trappers=YES

c. cp /etc/vsftpd/vsftpd.conf /etc/vsftpd/vsftpd.conf.bak \ rm -f /etc/vsftpd/vsftpd.conf

cp /etc/vsftpd/vsftpd.conf .bak /etc/vsftpd/vsftpd.conf \ rm -f /etc/vsftpd/vsftpd.conf.bak

说明:cp 和mv命令对selinux security context影响 cp将拷贝过去的文件的context改变为目的目录的context,而mv则不会改变移动文件的context

(I’ve had problems like this before, and I finally found out what the problem was. When you ‘mv’ a file (like a config file from a home dir to the proper location) it keeps the selinux context setting from the originating directory. When you ‘cp’ a file, it will change that context to the context of the directory being moved too. I have mv’d backups of configs from home dir to /etc and ran into the same error message. If you do a fixfiles relabel, or touch /.autorelabel and reboot, it should re-write the security context and hopefully clear up your problems.)

d. 关闭 xinetd 服务, 先启动 vsftpd, 再启动xinetd . (删除gssftp)

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics