pigallery2: image:bpatrik/pigallery2:latest container_name:pigallery2 environment: -NODE_ENV=production# set to 'debug' for full debug logging # - NODE_OPTIONS=--enable-source-maps # enable source map support on the backend for development volumes: -"./config:/app/data/config"# CHANGE ME -"db-data:/app/data/db" -"./images:/app/data/images:ro"# CHANGE ME, ':ro' means read-only -"./tmp:/app/data/tmp"# CHANGE ME expose: -"80" restart:always
server { listen 8083 default_server; listen [::]:8083 default_server;
server_name case.carlzeng.com; # CHANGE ME return 301 https://$server_name$request_uri; }
server { server_name carlzeng.com; # CHANGE ME
# Only allow all methods (GET,POST,PUT,etc..) for root (/pgapi). # see https://github.com/bpatrik/pigallery2/issues/214 location /pgapi { # NOTE: no ending '/' as it would forward /pgapi to / proxy_pass http://pigallery2:80; # forwarding to the other container, named 'pigallery2' proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; }
location / { limit_except GET { deny all; } proxy_pass http://pigallery2:80; # forwarding to the other container, named 'pigallery2' proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; }
root@debian12:~/pigallery2# apt install -y rsync Reading package lists... Done Building dependency tree... Done Reading state information... Done Suggested packages: python3-braceexpand The following NEW packages will be installed: rsync 0 upgraded, 1 newly installed, 0 to remove and 37 not upgraded. Need to get 417 kB of archives. After this operation, 795 kB of additional disk space will be used. Err:1 http://deb.debian.org/debian bookworm/main amd64 rsync amd64 3.2.7-1 404 Not Found [IP: 151.101.90.132 80] E: Failed to fetch http://deb.debian.org/debian/pool/main/r/rsync/rsync_3.2.7-1_amd64.deb 404 No t Found [IP: 151.101.90.132 80] E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
root@DS918:~# rsync -avzh --progress /volume2/homes/13261977480/Photos carlzeng***@192.168.6.117:/root/pigallery2/images The authenticity of host '192.168.6.117 (192.168.6.117)' can't be established. ECDSA key fingerprint is SHA256:2DtPJyL4F/scW7WqVrX7G4KimA8kokRW8DjCUV3MZp8. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '192.168.6.117' (ECDSA) to the list of known hosts. carlzeng@192.168.6.117's password: sending incremental file list rsync: [Receiver] ERROR: cannot stat destination "/root/pigallery2/images": Permission denied (13) rsync error: errors selecting input/output files, dirs (code 3) at main.c(772) [Receiver=3.2.7]
切换思路, 既然root用户无法登录ssh, 其他用户又无法访问到/root目录下面的所有文件;
那就把照片的目录换到最顶级, 让大家(所有ssh登录的用户)都可以访问的位置, 比如 /
1 2 3 4 5 6 7 8 9 10 11
rsync -avzh --progress /volume2/homes/13261977480/Photos carlzeng***@192.168.6.117:/ carlzeng***@192.168.6.117's password: sending incremental file list rsync: [generator] recv_generator: mkdir "/Photos" failed: Permission denied (13) *** Skipping any contents from this failed directory *** Photos/ sent 2.38M bytes received 13.90K bytes 368.38K bytes/sec total size is 8.45G speedup is 3,528.67 rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1462) [sender=3.1.2]
The –password-file option may only be used when accessing an rsync daemon. rsync error: syntax or usage error (code 1) at main.c(1666) [sender=3.1.2]
解决办法:
sshpass
DS918无法安装sshpass
切换方案到
1
cd to a private directory of the user which will be running the script (typically “$HOME/.ssh”, to be created if needed). That directory must be protected to write acces from other users, fix the modes if needed.
generate the keypair using command “ssh-keygen” (“/usr/syno/bin/ssh-keygen” if not in your PATH)
at the prompt “Enter file in which to save the key”, choose a file name (let’s say “mykey”)
at the prompt “Enter passphrase (empty for no passphrase):” press return (this will create a passwordless private key)
Two files will be created: “mykey” and “mykey.pub”
copy the contents of mykey.pub inside “$HOME/.ssh/authorized_key” file of user account on the remote machine your script is going to connect to.
in your script, add “-i“ as argument to the ssh command