agarbato / unicloud

Unison file sync web interface
MIT License
64 stars 4 forks source link

SSH permission denied #39

Closed billotronic closed 9 months ago

billotronic commented 9 months ago

I am having issues getting this up and running on two computers on the same LAN.

Error on client is

uni-unicloud_client-1 | SSH Connection KO, exit code 255, output unison@192.168.0.104: Permission denied (publickey,password,keyboard-interactive).

I have checked that the server has the pubkey listed and it is there. Not sure what else can be the problem

agarbato commented 9 months ago

Hi,

If pubkey is already on server authorized keys means client registration completed successfully. Did you activate the client from the UI?

Do you have SERVER_DEBUG=True on server? In that case you should see on server /data/log/sshd.log which should give you some info.

If you can share docker-compose files I can have a look. This can also happen if data folder is not clean (for example you changed role from server to client without cleaning data folder).

billotronic commented 9 months ago

Yes, client activated via server GUI

Last lines of sshd.log:

Authentication refused: bad ownership or modes for directory /data Failed publickey for unison from 192.168.0.146 port 41660 ssh2: RSA SHA256:hfMvC9U6t2pU8Zz4Z+jP7/ZBw1u+Hl6bIB+J7QbeaS0 Failed none for unison from 192.168.0.146 port 41660 ssh2 Failed password for unison from 192.168.0.146 port 41660 ssh2 Failed password for unison from 192.168.0.146 port 41660 ssh2 Connection closed by authenticating user unison 192.168.0.146 port 41660 [preauth] Connection from 192.168.0.146 port 47476 on 172.19.0.2 port 22 rdomain "" Authentication refused: bad ownership or modes for directory /data Failed publickey for unison from 192.168.0.146 port 47476 ssh2: RSA SHA256:hfMvC9U6t2pU8Zz4Z+jP7/ZBw1u+Hl6bIB+J7QbeaS0 Failed none for unison from 192.168.0.146 port 47476 ssh2 Failed password for unison from 192.168.0.146 port 47476 ssh2 Failed password for unison from 192.168.0.146 port 47476 ssh2 Connection closed by authenticating user unison 192.168.0.146 port 47476 [preauth] Connection from 192.168.0.146 port 40028 on 172.19.0.2 port 22 rdomain ""

`version: "3.3" services:

SERVER

test_unicloud_server: image: agarbato1/unison-unicloud ports:

`version: '3.3' services:

CLIENT

unicloud_client: image: agarbato1/unison-unicloud environment:

Thank you very much for your prompt answer. This project is super slick.

agarbato commented 9 months ago

Thank you for sharing compose files. It seems there's an issue with /data folder permission on server side. When that happens ssh refuses to accept keys. Is USER_UID=1000 a valid user on your server? You can check with id command.

Also make sure /mnt/user/dockerdata/uni permission is not 777 Normally on startup we check and fix /data permission, you can check on docker-compose logs on server side. /mnt/user/dockerdata/uni should be owned by user id 1000 on you system.

You can fix manually but it shouldn't be necessary. My guess is you server uid is not 1000.

chmod go-w /mnt/user/dockerdata/uni chmod 700 /mnt/user/dockerdata/uni/.ssh chmod 600 /mnt/user/dockerdata/uni/.ssh/unicloud_authorized_keys

billotronic commented 9 months ago

After doing some more digging on my end, this is most definitely a permissions issue due to my host setup for the server. Please close this and I thank you very much for trying to help sort me out.

agarbato commented 9 months ago

You're very welcome.