Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # CREATE SFTP SERVER
- # 1. SFTP Directory
- # create a directory that will house our FTP data
- mkdir -p /data
- chmod 701 /data
- # 2. Create the SFTP group and user
- # Now we're going to create a special group for SFTP users
- groupadd sftp_users
- # Now we're going to create a special user that doesn't have regular login privileges, but does belong to our newly created sftp_users group
- useradd -g sftp_users -d /upload -s /sbin/nologin sftpuser
- # Next, give the new user a password
- passwd sftpuser (contoh password: usersftp)
- # 3. Create the new user SFTP directory
- mkdir -p /data/sftpuser/upload
- chown -R root:sftp_users /data/sftpuser
- chown -R sftpuser:sftp_users /data/sftpuser/upload
- # Configure sshd
- # Open up the SSH daemon configuration file
- vi /etc/ssh/sshd_config
- # At the bottom of that file, add the following:
- Match Group sftp_users
- ChrootDirectory /data/%u
- ForceCommand internal-sftp
- # Save and close that file. Restart SSH with the command:
- systemctl restart sshd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement