cazz  
                
                  
                    January 16, 2022, 12:37pm
                   
                  1 
               
             
            
              I have see some old topic here about the question and I just wonder if that have make it simple to create a secure file server with nethserver.
Just wonder is that is still template and script or is it more easy now with GUI?
             
            
              
           
          
            
              
                mrmarkuz  
              
                  
                    January 16, 2022,  9:05pm
                   
                  2 
               
             
            
              You still need a custom template for the chroot jail.
Fail2ban already blocks bad SSH logins and there’s also 2FA for SSH  for additional security.
             
            
              
           
          
            
              
                cazz  
              
                  
                    January 17, 2022,  3:59pm
                   
                  3 
               
             
            
              Ahh ok then I going to see what I can do 
             
            
              
           
          
            
              
                cazz  
              
                  
                    January 17, 2022,  4:37pm
                   
                  4 
               
             
            
              Hi againSFTP chroot howto - Howto - NethServer Community 
but have not got it to work.
I think it have to do something about how to connect the template to the group.
Nethserver have a local LDAP that have a user and group (call chrooted) but not sure how to connect the group from LDAP to the template.
I have try with both “chrooted@mydomain.se” and “chrooted@sftp.mydomain.se” and even just “chrooted”
             
            
              
           
          
            
              
                mrmarkuz  
              
                  
                    January 17, 2022,  7:10pm
                   
                  5 
               
             
            
              There’s an error in the howto.
To apply the configuration and write the config files for sshd
signal-event nethserver-openssh-save
is needed instead of
signal-event nethserver-sssd-save
You may check if /etc/ssh/sshd_config contains the needed line for chroot:
ChrootDirectory /var/lib/nethserver/home/
             
            
              
           
          
            
              
                cazz  
              
                  
                    January 17, 2022,  7:20pm
                   
                  6 
               
             
            
              Thanks, now it works 
I did try to add/var/lib/nethserver/home/%u
             
            
              
           
          
            
              
                mrmarkuz  
              
                  
                    January 17, 2022,  7:36pm
                   
                  7 
               
             
            
              
Yes, the home folders need to be owned by root to make chroot work.
This should work for the home folders:
ChrootDirectory %h
 
            
              
           
          
            
              
                cazz  
              
                  
                    January 17, 2022,  7:44pm
                   
                  8 
               
             
            
              if I use %h I can’t login at all.
             
            
              
           
          
            
              
                mrmarkuz  
              
                  
                    January 17, 2022,  7:46pm
                   
                  9 
               
             
            
              Did you change owner for the user folder?
chown root: /var/lib/nethserver/home/user
             
            
              
           
          
            
              
                cazz  
              
                  
                    January 17, 2022,  7:51pm
                   
                  10 
               
             
            
              Yes I did and now user have no access to it own home folders.
             
            
              
           
          
            
              
                mrmarkuz  
                
                  
                    January 17, 2022,  7:59pm
                   
                  11 
               
             
            
              Sorry, you need to set permissons too:
chmod 755 /var/lib/nethserver/home/user
Source:
             
            
              1 Like 
            
           
          
            
              
                cazz  
              
                  
                    January 17, 2022,  8:04pm
                   
                  12 
               
             
            
              ok have read but 755 make a user access his and his friends home folder 
             
            
              1 Like 
            
           
          
            
              
                pagaille  
              
                  
                    February 1, 2022,  8:13am
                   
                  13 
               
             
            
              
Thanks for correcting that @mrmarkuz . @cazz  I’m happy my howto could help someone else.
             
            
              1 Like