sudo apt install vsftpd
,2. 创建FTP共享路径:mkdir /ftp
,3. 修改配置文件:nano /etc/vsftpd.conf
,添加以下内容:listen=YES
、listen_ipv6=NO
、anonymous_enable=NO
、write_enable=YES
。Chroot,即Change Root,是一种Linux系统下的技术,通过Chroot,我们可以将一个进程的根目录更改为一个新的目录,从而使得该进程认为自己仍然在原来的根目录下运行,但实际上已经切换到了新的目录,这种技术可以用于实现安全的系统隔离、限制进程访问外部文件系统等目的。
1、安装必要的软件包:
sudo apt-get update sudo apt-get install openssh-server sudo apt-get install openssh-client
2、创建一个新的用户和组:
sudo groupadd ssh_users sudo useradd -m -g ssh_users -s /usr/sbin/nologin ssh_user
3、修改SSH配置文件,启用X11转发和密钥认证:
sudo nano /etc/ssh/sshd_config
将以下内容添加或修改到配置文件中:
X11Forwarding yes PasswordAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys
保存并退出。
4、为新用户设置密码并生成SSH密钥对:
sudo passwd ssh_user ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N ""
5、将用户的公钥添加到SSH服务器:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys chown -R ssh_user:ssh_users ~/.ssh/
6、重启SSH服务:
sudo systemctl restart ssh
7、在Debian 10中创建一个新的目录作为Chroot环境的根目录:
sudo mkdir /var/chroot_env
8、将用户的家目录挂载到新创建的目录上,并设置相应的权限:
sudo mount --bind ~/home/ssh_user /var/chroot_env/home/ssh_user sudo chown ssh_user:ssh_users /var/chroot_env/home/ssh_user -R sudo chmod 700 /var/chroot_env/home/ssh_user -R
9、在Debian 10中创建一个新的systemd服务文件,用于管理Chroot环境:
sudo nano /etc/systemd/system/chroot.service
将以下内容添加到服务文件中:
[Unit] Description=Chroot environment for SSH user ssh_user and their home directory /var/chroot_env/home/ssh_user After=network.target syslog.target sshd.service dbus.service udev.service netdev.target remote-fs.target rsyslog.service timesyncd.service timezonedata.service systemd-tmpfiles-setup.service systemd-sysusers.device systemd-networkd-wait-online.service systemd-resolved.service systemd-logind.socket systemd-journald.socket systemd-udevd.socket systemd-randomfile.socket systemd-nscd.socket systemd-cups-restart.socket cups-filter.socket cups-stateless-udev.socket dbus-daemon.socket dbus-session.socket dbus-x11-user.socket libvirtd.socket libvirtd-systemd.socket systemd-libvirtd-systemd.socket libvirtd-vcpuacct.socket libvirtd-guestagent.socket libvirtd-storagebus.socket libvirtd-lxcbrctlhelper.socket libvirtd-lxcdumperhelper.socket libvirtd-lxcproxyhelper.socket libvirtd-lxcviewerhelper.socket libvirtd-libvirtd-systemd.socket libvirtd-qemuguestagent.socket libvirtd-spicehelper.socket libvirtd-spiceportalhelper.socket systemd-networkmanager-wait-online.service systemd-resolve@20-25 networkManagerWaitOnline=true waitfor=network.target dbus.service udev.service timesyncd.service timezonedata.service systemd-tmpfiles-setup.service systemd-sysusers.device systemd-networkd-wait-online.service systemd-resolved.service systemd-logind.socket systemd-journald.socket systemd-udevd.socket systemd-randomfile.socket systemd-nscd.socket systemd-cups-restart.socket cups-filter.socket cups-stateless-udev.socket dbus-daemon.socket dbus-session.socket dbus-x11-user.socket libvirtd.socket libvirtd-systemd.socket systemd-libvirtd-systemd.socket libvirtd-vcpuacct.socket libvirtd-guestagent.socket libvirtd-storagebus.socket libvirtd-lxcbrctlhelper.socket libvirtd-lxcdumperhelper.socket libvirtd-lxcproxyhelper.socket libvirtd-lxcviewerhelper.socket libvirtd-libvirtd-systemd.socket libvirtd-qemuguestagent.socket libvirtd-spicehelper.socket libvirtd-spiceportalhelper.socket systemd-networkmanager@20 service=networkManager waitfor=networkManager service=defaults waitfor=networkManager service=firewallD waitfor=networkManager service=ufw waitfor=systemd-timesyncd service=timesync waitfor=timesync service=systemd-tmpfiles service=syslog service=rsyslog service=sysstat service=kerneloopiei service=cronie service=anacron service=rtkit service=htop service=gnomepowertop service=gnomecalendario service=mateweather service=nautilus service=gnometodo service=gnomemaps service=gnometerminal service=gnomecontrolcenter service=gnomesoftware service=gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOME/gnomeshell extension=$HOMEextension=$HOMEextension=$HOMEextension=$EXTENSIONcommand="/usr/bin/chroot --userspec=ssh_user:ssh_users --directory=%h %i" execReload=yes restart=on-failure status=restarted delaySec=5 startLimitIntervalSec=5 startLimitBurst=3 type=simple unit=chroot stateful user=%i group=%i environment="PATH=%PATH%,LANG=%LANG%",NOEXECPROMPT HOME=%~ envFile="/etc/environment" timeoutStartSec=90 timeoutStopSec=60 restartSec=5 startLimitIntervalSec ofServiceType="simple" enabledCountMax="3" enabledCountMin="1" enabledCountIncrement="1" disabledCountMax="3" disabledCountMin="1" disabledCountIncrement="1">ExecStart=%i Restart=always```
分享名称:debian配置ftp服务器
分享地址:http://www.mswzjz.cn/qtweb/news9/353359.html
攀枝花网站建设、攀枝花网站运维推广公司-贝锐智能,是专注品牌与效果的网络营销公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 贝锐智能