0

I'm getting the following error while trying to connect to server via sftp : "client_loop: send disconnect: Broken pipe" Could someone help me ?

Server : Ubuntu 22.04 lts

1. chown -hR root:root /mnt : -> make root the owner of /mnt and all its sub directories 
2. chmod 755 -R -f /mnt : -> set permissions
3. groupadd users : -> add group
4. adduser --home /mnt/disk2/users/jo jo - > make user's Home
5. usermod -a -G users jo : -> add user to group
6. chown -hR jo:jo /mnt/disk2/users/jo : -> give ownership to jo
7. chmod -R 775 /mnt/disk2/users/jo : -> set permissions

nano /etc/ssh/sshd_config

Match group users
ChrootDirectory %h
ForceCommand internal-sftp
AllowTcpForwarding no

Reboot

In "/etc/ssh/sshd_config" if I change "ChrootDirectory %h" to "ChrootDirectory /mnt/disk2/users", I can login, but it is not restricted to jo's home, as I wanted.

Kind Regards,

Jo

2

1 Answer 1

0

Thanks again Kenster for your advice.

As I have a clean server, I decided to create User's Home folder in DISK 1 and put DATA only in DISK 2.

1. groupadd employees

2. groupadd managers

3. adduser --gecos hello jo <<EOF
mypassword
mypassword
EOF 

4. usermod -a -G employees jo

5. chown -R root:root /mnt

6. chmod 700 -R -f /mnt

7. mkdir -p /mnt/disk2/root

8. mkdir -p /mnt/disk2/root/employees

9. mkdir /mnt/disk2/root/employees/jo

10. chown -R jo:managers /mnt/disk2/root/employees/jo

11. chmod -R 770 /mnt/disk2/root/employees/jo

12. nano /etc/ssh/ssh_config
    Match group employees
            ChrootDirectory /mnt/disk2/root/employees
            ForceCommand internal-sftp -d /%u
            AllowTcpForwarding no
            X11Forwarding no

13. service ssh restart

This works fine :-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .