diff --git a/tasks/enduro-trails/prototype/fix_nginx_perms.js b/tasks/enduro-trails/prototype/fix_nginx_perms.js new file mode 100644 index 0000000..3d127f3 --- /dev/null +++ b/tasks/enduro-trails/prototype/fix_nginx_perms.js @@ -0,0 +1,35 @@ +const { Client } = require('ssh2'); +const conn = new Client(); +function exec(conn, cmd) { + return new Promise((resolve, reject) => { + conn.exec(cmd, (err, stream) => { + if (err) return reject(err); + let out = ''; + stream.on('data', d => out += d); + stream.stderr.on('data', d => out += d); + stream.on('close', () => resolve(out.trim())); + }); + }); +} +conn.on('ready', async () => { + console.log('✅ Connected\n'); + + // Проверить права на /home/slin + const homePerm = await exec(conn, 'stat -c "%a %U %G" /home/slin'); + console.log('home/slin perms:', homePerm); + + // Дать www-data доступ к /home/slin (execute bit для others) + const chmod1 = await exec(conn, 'echo motoZ@yaz2010 | sudo -S chmod o+x /home/slin'); + console.log('chmod home/slin:', chmod1 || 'ok'); + + // Дать доступ к enduro-trails/data + const chmod2 = await exec(conn, 'echo motoZ@yaz2010 | sudo -S chmod -R o+rX /home/slin/enduro-trails/data/terrain/'); + console.log('chmod terrain:', chmod2 || 'ok'); + + // Проверить снова + const http = await exec(conn, 'curl -o /dev/null -s -w "%{http_code}" "https://openclaw.mva154.duckdns.org/enduro/terrain/hypso/8/75/42.png"'); + console.log('HTTP после фикса:', http); + + conn.end(); +}); +conn.connect({ host: '82.22.50.71', username: 'slin', password: 'motoZ@yaz2010', readyTimeout: 15000 });