centos 7.6 离线安装 ftp

目录

 

下载ftp

安装vsftpd

遇到的问题:

安装ftp客户端


下载ftp

首先检查一下是否已经安装:

rpm -qa | grep vsftpd

什么都没出现,说明没有安装。

下载对应版本的FTP服务器:http://rpmfind.net/linux/rpm2html/search.php?query=vsftpd(x86-64)

我下载的是这个版本:

同时下载好ftp客户端,为后续测试准备,我下载下图版本:

准备好软件,上传至服务器,正式进入安装步骤。


安装vsftpd

  • 安装vsftpd,防止依赖错误,建议强制安装
rpm -ivh vsftpd-3.0.2-28.el7.x86_64.rpm --force --nodeps
  • 配置ftp,主要配置 vsftpd.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).
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=NO
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list
userlist_deny=NO
#
# 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

reverse_lookup_enable=NO
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
allow_writeable_chroot=YES
local_root=/home/ftp
pasv_enable=YES
pasv_min_port=6000
pasv_max_port=7000
  • 开放相关防火墙端口(21,6000-7000端口)
firewall-cmd --zone=public --add-port=6000-7000/tcp --permanent   # 开放6000-7000端口

firewall-cmd --zone=public --remove-port=6000-7000/tcp --permanent  #关闭6000-7000端口

firewall-cmd --reload   # 配置立即生效

firewall-cmd --zone=public --list-ports   #查看防火墙所有开放的端口

  • 添加ftp用户及权限
useradd -d /home/ftp -s /sbin/nologin ftpup #添加用户 
passwd ftpup   #设置密码
输入用户密码    #输入密码
再次输入密码    #再次输入密码
  • 重启ftp
service vsftpd stop  #停止ftp
service vsftpd start #启动ftp

遇到的问题:

  • 问题1:配置用户时,使用 /sbin/nologin ,但shells 没有配置
530 Login incorrect.
Login failed.
ftp> ls -l
530 Please login with USER and PASS.
Passive mode refused.

      解决办法:vim /etc/shells  增加  /sbin/nologin

  • 问题2:未在 chroot_list 文件中添加ftp 用户
Password:
500 OOPS: could not read chroot() list file:/etc/vsftpd/chroot_list
Login failed.
ftp> ls -l
421 Service not available, remote server has closed connection
Passive mode refused.
ftp> pwd
Not connected.
  • 问题3:没有把6000-7000的端口配置上
227 Entering Passive Mode (10,7,70,36,125,71).
ftp: connect: 没有到主机的路由
  • 问题4:没有目录权限
200 PORT command successful. Consider using PASV.
553 Could not create file.

 


安装ftp客户端

同样先检查是否安装:

rpm -qa | grep ftp

以强制安装方式 进行安装:

rpm -ivh ftp-0.17-67.el7.x86_64.rpm --force --nodeps

测试

ftp 192.x.x.x
#输入用户名
#输入密码
#提示:login successful 

 

  • 1
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
### 回答1: 离线安装VNCServer需要先下载所需的软件包。你可以通过官方网站或镜像站点下载CentOS 7.6的VNCServer软件包,解压后将软件包放置在本地电脑。接着,按照以下步骤进行安装: 1. 首先,通过SSH远程登录到CentOS 7.6的服务器。确保你没有安装任何VNC相关的软件。 2. 使用以下命令安装VNCServer软件包: ```bash rpm -ivh /path/to/vncserver.rpm ``` 其中,/path/to/是VNCServer软件包所在路径。你需要将此路径替换为你自己的路径。 3. 安装完成后,使用以下命令启动VNCServer: ```bash vncserver :1 ``` 其中,:1是VNCServer的显示号码。你可以根据需要更改此参数。 4. 启动VNCServer后,你需要设置VNCServer的密码。使用以下命令设置: ```bash vncpasswd ``` 按照提示输入VNCServer密码并确认。 5. 启用防火墙以允许VNC连接。使用以下命令打开端口: ```bash firewall-cmd --add-port=5901/tcp --permanent ``` 6. 最后,重启防火墙使更改生效: ```bash firewall-cmd --reload ``` 至此,你已经成功在CentOS 7.6离线安装并启动了VNCServer。你现在可以通过任何VNC客户端连接到服务器了。 ### 回答2: CentOS7.6离线安装VNCServer需要下载安装包以及依赖包,步骤如下: 1. 在其他联网的机器上下载所需的安装包和依赖包,在CentOS7.6上通过U盘等方式将文件复制到服务器。 2. 安装必要的依赖包,包括: - gcc - libXtst-devel - libXt-devel - libXfont - twm 3. 安装VNCServer,执行命令: rpm -Uvh tigervnc-server-*.rpm rpm -Uvh tigervnc-server-module*.rpm rpm -Uvh pixman*.rpm rpm -Uvh xorg-x11-fonts-100dpi*.rpm 4. 配置VNCServer,编辑/etc/systemd/system/vncserver@.service文件并设置相关参数,然后重启systemd: [Unit] Description=Remote desktop service (VNC) After=syslog.target network.target [Service] Type=forking ExecStart=/usr/sbin/runuser -l ${USER} -c "/usr/bin/vncserver %i" ExecStop=/usr/sbin/runuser -l ${USER} -c "/usr/bin/vncserver -kill %i" PIDFile=/home/${USER}/.vnc/%H%i.pid EnvironmentFile=/etc/sysconfig/vncservers [Install] WantedBy=multi-user.target 5. 创建VNC用户账号和密码,执行命令: useradd vncuser passwd vncuser 6. 启动VNCServer,执行命令: systemctl start vncserver@:1.service 7. 设置VNCServer开机自启,执行命令: systemctl enable vncserver@:1.service 以上就是CentOS7.6离线安装VNCServer的全部步骤,如果需要在多用户环境中使用,可以根据实际需求进行用户账号和VNCServer端口的配置。 ### 回答3: 首先,需要在centos7.6上安装vncserver。由于需要离线安装,因此需要先下载vncserver的rpm安装包。可以从官网下载适用于centos7.6的vncserver的安装包,在本地进行存储。然后,执行以下操作: 1. 首先,需要安装依赖库。 yum -y install pixman pixman-devel libXfont 2. 执行vncserver的安装命令。其中,安装包的名称根据实际情况进行更改。 rpm -ivh vncserver-6.7.11-2.x86_64.rpm 3. 安装成功后,需要进行配置。进入/etc/sysconfig,找到vncservers文件。 cd /etc/sysconfig vim vncservers 4. 修改vncserver配置文件。在文件末尾添加以下内容,其中1代表端口号,可根据需要进行修改。此外,需要设置vnc密码,可通过 vncpasswd 命令设置,然后将生成的文件名填写在下面的-vncpasswd选项中。 VNCSERVERS="1:root" VNCSERVERARGS[1]="-geometry 1280x1024 -depth 16 -randr 1 -noxdamage -alwaysshared -localhost -SecurityTypes VncAuth -vncpasswd /root/.vnc/passwd" 5. 配置完成后,启动vncserver。 vncserver 到此,centos7.6离线安装vncserver就配置完成了。可以使用vncviewer工具来进行连接测试,输入IP地址+端口号并输入密码即可。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

liuguichenglove

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值