Closed as not planned
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
Modifying sshd_config with a custom-cont-init.d script to set ChrootDirectory leads to an Connection to *************** closed by remote host.
error when trying to SSH/SFTP.
openssh log reads:
server lacks privileges to chroot to ChrootDirectory
Expected Behavior
I should be able to change the default directory I land on when SSHing/SFTPing.
Steps To Reproduce
- Bind a volume in the docker-compose.yml containing a shell script that sed the sshd_config file to set ChrootDirectory
(sed -i 's|#ChrootDirectory none|ChrootDirectory [directory]|' /etc/ssh/sshd_config
) - Launch the container
- Try to SSH into the container
Environment
- OS: Debian 12
- How docker service was installed: official process
CPU architecture
x86-64
Docker creation
...
services:
openssh-server:
image: lscr.io/linuxserver/openssh-server:latest
container_name: openssh-server
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- SUDO_ACCESS=false #optional
- PASSWORD_ACCESS=true #optional
- USER_PASSWORD=[password] #optional
- USER_NAME=[user] #optional
volumes:
- ./configs/openssh/custom-cont-init.d:/custom-cont-init.d:ro
- [named volume]:[directory]
ports:
- 2222:2222
restart: always
Container logs
User name is set to [user]
sudo is enabled with password.
ssh-keygen: generating new host keys: RSA ECDSA ED25519
sshd is listening on port 2222
User/password ssh access is enabled.
[custom-init] Files found, executing
[custom-init] update_sshd_config.sh: executing...
··· Modification de sshd_config ···
[custom-init] update_sshd_config.sh: exited 0
[ls.io-init] done.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Done