mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
feat: add permission grant command when key generation fails
This commit is contained in:
@@ -20,6 +20,12 @@ const COMMAND_TO_ALLOW_LOCAL_ACCESS = `
|
|||||||
echo "✓ Dokploy SSH key added successfully. Reopen the terminal in Dokploy to reconnect."
|
echo "✓ Dokploy SSH key added successfully. Reopen the terminal in Dokploy to reconnect."
|
||||||
# ----------------------------------------`;
|
# ----------------------------------------`;
|
||||||
|
|
||||||
|
const COMMAND_TO_GRANT_PERMISSION_ACCESS = `
|
||||||
|
# ----------------------------------------
|
||||||
|
sudo chown -R $USER:$USER /etc/dokploy/ssh
|
||||||
|
# ----------------------------------------
|
||||||
|
`;
|
||||||
|
|
||||||
export const getPublicIpWithFallback = async () => {
|
export const getPublicIpWithFallback = async () => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
let ip = null;
|
let ip = null;
|
||||||
@@ -105,7 +111,17 @@ export const setupTerminalWebSocketServer = (
|
|||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(`Error setting up private SSH key: ${error}`);
|
console.error(`Error setting up private SSH key: ${error}`);
|
||||||
ws.send(`Error setting up private SSH key: ${error}`);
|
ws.send(`Error setting up private SSH key: ${error}\n`);
|
||||||
|
|
||||||
|
if (
|
||||||
|
error instanceof Error &&
|
||||||
|
error.message.includes("Permission denied")
|
||||||
|
) {
|
||||||
|
ws.send(
|
||||||
|
`Please run the following command on your server to grant permission access and then reopen this window to reconnect:${COMMAND_TO_GRANT_PERMISSION_ACCESS}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
ws.close();
|
ws.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,13 +15,6 @@ export const getShell = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Returns private SSH key for dokploy local server terminal. Uses already created SSH key or generates a new SSH key.
|
/** Returns private SSH key for dokploy local server terminal. Uses already created SSH key or generates a new SSH key.
|
||||||
*
|
|
||||||
* In case of permission failures when running locally, run the command below:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo chown -R $USER:$USER /etc/dokploy/ssh
|
|
||||||
```
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
export const setupLocalServerSSHKey = async () => {
|
export const setupLocalServerSSHKey = async () => {
|
||||||
const { SSH_PATH } = paths(true);
|
const { SSH_PATH } = paths(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user