1、步骤如下:
#Add a new group for sftp users groupadd sftpusergroup $add this to the sshd_config (编辑 /etc/ssh/sshd_config) Match Group sftpusergroup ChrootDirectory %h ForceCommand internal-sftp #restart sshd /etc/init.d/sshd restart #add a user useradd -s /bin/false -G sftpusergroup testuser passwd testuser #root must own the user’s home directory for the chroot to work properly. chown root ~testuser #user must have permission to traverse the directory. testuser should already have group permission chmod 750 ~testuser
2、一些linux用法解释:
- 删除用户:userdel testuser
- 删除组:groupdel sftpusergroup
- sftp连接时,利用指定端口 sftp -oPort=3022 testuser@localhost
- http://bbs.chinaunix.net/thread-2248273-1-1.html
- chmod 777 /home/testuser (注意到testuser这个文件夹可以看成是一个特殊的文件。)
chmod用法:
refurl:
http://bbs.chinaunix.net/thread-2248753-1-1.html
http://www.ezloo.com/2008/03/add_and_delete_user.html
http://bbs.chinaunix.net/thread-1547966-1-1.html 另一个人的新建用户的方法,感觉不错,未测试。
http://www.linuxso.com/command/chmod.html chmod用法
http://wangshuxing123-126-com.iteye.com/blog/695653 chmod用法
http://www.uzzf.com/news/7902.html 最开始的教程,可是一直不成功。
http://www.9usb.net/201005/linux-ls.html ls -l的用法以及含义