kevin2458

SFTP

Mar 20th, 2018
167
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- SFTP
  2.  
  3.  
  4. groupadd sftpusers
  5.  
  6.  
  7. useradd -g sftpusers -d / -s /bin/false kevinlara
  8.  
  9. passwd kevinlara
  10.  
  11. grep kevinlara /etc/passwd
  12.  
  13.  
  14. useradd -g sftpusers -d / -s /bin/false henrrylopez
  15.  
  16. passwd henrrylopez
  17.  
  18. grep henrrylopez /etc/passwd
  19.  
  20.  
  21. cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original
  22.  
  23. vi /etc/ssh/sshd_config
  24.  
  25.  
  26. PasswordAuthentication yes
  27.  
  28. Subsystem sftp internal-sftp
  29.  
  30.  
  31. # Added by Kevin Lara
  32.  
  33. Match User kevinlara
  34.     ChrootDirectory /var/www/html
  35.     ForceCommand internal-sftp
  36.  
  37. Match User henrrylopez
  38.     ChrootDirectory /var/www/html/v2
  39.     ForceCommand internal-sftp
  40.  
  41.  
  42. service sshd restart
  43.  
  44.  
  45. # Group permissions
  46.  
  47. chgrp -R sftpusers /var/www/html
  48.  
  49.  
  50. chown root:root /var/www/html
  51.  
  52. chown root:root /var/www/html/v2
  53.  
  54.  
  55. chmod -R 775 /var/www/html
  56.  
  57.  
  58. chmod 755 /var/www/html
  59.  
  60. chmod 755 /var/www/html/v2
RAW Paste Data