New SFTP user with limited rights


#21

I am almost 100% certain I did restart it but I just did it now and it seems to have resolved the issue. I am able to connect now. I see an html link inside the home folder but it doesn’t seem to work. Should it work with EE docker setup? Also, could I ask you one last thing? I am really thankful for all your help by the way. Can you tell me how to generate a separate key for www-data while setting this up? I would rather that user have a different key than the root user if possible.


#22


#23

I assume the issue is that it is pointing to /var/www/html but EE4 uses /var/lib/docker/volumes/examplecom_htdocs/_data for the WP content.


#24

Docker stores everything in /var/lib/docker but when you run a container, it uses its own filesystem. If you’re not seeing anything in the ssh container html symlink then you probably didn’t mount your site’s volumes via --volumes-from

docker run -d --rm \
--name ssh \
-v ssh:/home/www-data/.ssh \
--volumes-from php-container \
-p 2222:22 \
demyx/ssh

#25

You can replace the pub keys in the ssh container’s authorized-keys.

# First generate your key on your host
ssh-keygen -t ed25519 -C "SSH Container"

# Then copy your new pub key
docker cp ~/.ssh/id_ed25519.pub ssh:/home/www/.ssh/authorized_keys

# Restart container
docker restart ssh

And then finally download the id_ed25519 and id_ed25519.pub to your computer/laptop using your root account so you can sftp to the ssh container


#26

Okay, I understand that and I did use --volume-from devcfimortgagecom_php_1 / but when I try to access the html syslink and get the below error.

Error: Directory /var/www/html: no such file or directory
Error: Failed to retrieve directory listing

#27

Hmm weird, I haven’t used EEv4 in a long time so maybe they’re not using the default PHP location. Try finding the WP files:

docker exec -it ssh find / -name "wp-config.php"

#28

/var/www/wp-config.php


#29

There it is, just change your SFTP client directory to /var/www


#30

Any way during the install of your docker to tell it where to point the syslink?


#31

As long as the container doesn’t go down, this symlink will stay there. A more permanent solution is to rebuild my image using my Dockerfile but that’s a whole another story.

docker exec -it ssh ln -s /var/www /home/www-data

#32

Ahh, well thank you for everything! I am sure you have more important things to do than to help a n00b figure all this stuff out.


#33

The docker commands I’ve posted are just the surface of Docker, feel free to learn more from their docs page.