Wednesday 31 May 2023

Create SFTP user with home directory restriction

 



Restrict on the home directory and sftp only Ubuntu

create a group -
 
sudo addgroup group_name

create a user

useradd -m -d /home/username username

Assign group to user

usermod -g group_name username


restrict the directory and ftp

add below to the end of /etc/ssh/sshd_config file

   Match Group group_name
   ChrootDirectory /home/username
   ForceCommand internal-sftp
   X11Forwarding no
   AllowTcpForwarding no


Still unable to log in to sftp try to change the ownership to root for the user's home directory. 

Also check the mod of the home directory, it should be 755

No comments:

Post a Comment

Enable 'HTML Manager'- Apache Tomcat

 Enable 'HTML Manager'- Apache Tomcat Go to Apache-tomcat's home directory and edit the tomcat-users.xml ${apache_home}/conf/tom...