sftp login problems

June 2, 2014 1.8k views
and i am creating ftp server give below yum install -y vsftpd yum install -y ftp mkdir /home/data mkdir /home/data/user 1 user2 user3 user4 user5 useradd user1 useradd user2 useradd user3 useradd user4 useradd user5 usermod -d /home/data/user1 user1 usermod -d /home/data/user2 user2 usermod -d /home/data/user3 user3 usermod -d /home/data/user4 user4 usermod -d /home/data user5 vi /etc/vsftpd/vsftpd.conf edit nonymous_enable=no chroot_local_user=YES chroot_list_enable=YES chroot_list_file=/etc/vsftpd/chroot_list cd /home/vsftpd touch chroot_list setsebool -P allow_ftpd_full_access 1 when i am using ftp site outside network using filezilla its working fine using port number 21. user1,user2,user3,user4 only access the home directory only. user1 can't go another users directory. user5 access only four users home directory. when user1 access ftp site using sftp and port number 22 using user1 access remaining users accounts also. so how i can restrict user 1.
3 Answers
While they have similar names, SFTP and FTP are actually very different things, and they have completely separate configurations. To restrict a SFTP user, you need to edit the file /etc/ssh/sshd_config and add a section including:

Match User user1
ChrootDirectory /home/user1
ForceCommand internal-sftp
Digital ocean does not use ftp connections, as they are very inseguraas, what you can do is connect from ftp client on port 22.

Host: 107170192195
user: root
port: 22

You'll get a warning message about the connection, give everything and if ready.

what is the code to set user1's password to " 12345"

  • I wouldn't do that -- your server will be hacked in no time if you use a weak password such as 12345. You can change user1's password by running:

    sudo passwd user1

    as root or a user with sudo access.

Have another answer? Share your knowledge.