Closed tamasgal closed 2 years ago
+1 Also a ChrootDirectory option as an environment would be great. Plan to use this to pass out to non tech savvy friends and access to / at all would without a doubt add to there confusion.
Here you go tamasgal
https://serverfault.com/questions/499565/change-default-directory-when-i-ssh-to-server docker-compose.yml
environment:
PUBLIC_KEY: 'command="cd /home ; $SSH_ORIGINAL_COMMAND" ssh-rsa TTTTTrestofkeyTT== root@tttttttttttt'
I'm afraid I don't follow you. Why would you want to change the home folder inside the container? This container is designed for a single user. Config folder is supposed to be mapped to a folder on host. So just create separate containers for each user and customize the host folder mapping for each container.
I thought I could reuse this for a service which gives access to an NFS share in a swarm behind a load balancer and there I'd like to chroot the user and set the home to the mounted folder.
Anyways, I went with a custom docker image and pushed it to our private registry, I guess that's the better solution. My use-case is probably too special for feature request.
I've built a Docker Mod to do this: https://github.com/neingeist/docker-mod-openssh-server-tweaks
I'm currently trying to use this image in order to receive some backup files through sshfs (actually the only way proposed by Borg)
The current /config
home also happens to expose all the config of the server which can be an issue.
Chrooting the user into an empty directory would have been interesting for me too.
Actually even without talking about sshfs, is there a way to have all the server config located elsewhere that on the user's home ?
Actually even without talking about sshfs, is there a way to have all the server config located elsewhere that on the user's home ?
My mod https://github.com/neingeist/docker-mod-openssh-server-tweaks lets you set the home directory e.g. I use a directory different from /config for this.
But thanks for pointing out the other problem: the config in /config
is exposed too. I'll have a look.
Desired Behavior
Ability to set the user's home directory.
I'd like to use this Docker image to launch SSH microservices in our Docker Swarm and it would be nice if there was a way to set the user's home directory via e.g. an environment variable.
Current Behavior
The home directory is preset to
/config
and cannot be changed via a dynamic configuration. (At least I could not figure it out)Alternatives Considered
Tried setting
HOME
in a Docker YAML file but it has no effect. I also tried settingworking_dir
but it seems to have no effect either.