设为首页收藏本站

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 227|回复: 0

Granting a sftp user access to a /var/www directory

[复制链接]
发表于 2013-2-17 02:19:21 | 显示全部楼层 |阅读模式
This is the process:
  • Add the user: sudo adduser <username> www-data as per this answer
  • Add the user to the group: sudo usermod -aG www blub
    or just use sudo adduser <username> www-data in 1
  • Install nsftp apt-get install nsftp
  • Configure nsftp for remote access:
    nano /etc/nsftpd.conf
    inside the file set
    chroot_local_user=YES
    and ensure this is commented out:
    #chroot_list_enable=YES
    as per doco.
  • Restart nsftp: sudo /etc/init.d/vsftpd restart
  • Configure the user's home directory:
    sudo usermod -d /var/www/mysite/ftpaccessdir <username>
    ie not in \home
  • Configure ssh chroot
    nano /etc/ssh/sshd_config
    add the following to the end:
    Subsystem       sftp    internal-sftp
    Match user <username>
    ChrootDirectory /var/www/site
    ForceCommand internal-sftp
    AllowTcpForwarding no
    and ensure that further up in the file that this is commented out (ie before the one you just added)
    #Subsystem sftp /usr/lib/openssh/sftp-server
  • Restart ssh
    /etc/init.d/ssh restart
  • Change the permissions for apache:
    chown root:root /var/www
    chown root:root /var/www/site
    chmod 755 /var/www
    As in the docs here.
  • Ensure that your directory has www-data access
    sudo chown -R www-data:www-data /var/www/site
    chmod 755 /var/www/site


-http://askubuntu.com
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|BC Morning Website ( Best Deal Inc. 001 )  

GMT-8, 2025-8-26 09:04 , Processed in 0.016177 second(s), 17 queries .

Supported by Best Deal Online X3.5

© 2001-2025 Discuz! Team.

快速回复 返回顶部 返回列表